PHPackages                             issei-m/spike-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. issei-m/spike-php

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

issei-m/spike-php
=================

The client of https://spike.cc REST api for PHP.

v1.0-BETA5(8y ago)51.3k2MITPHPPHP &gt;= 5.5

Since Jan 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/issei-m/spike-php)[ Packagist](https://packagist.org/packages/issei-m/spike-php)[ RSS](/packages/issei-m-spike-php/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

Spike for PHP
=============

[](#spike-for-php)

\[ABANDONED\]
-------------

[](#abandoned)

This project is already abandoned due to [SPIKE](https://spike.cc) payment service close, and you can no longer access to their api endpoint anymore.

---

Latest release: [v1.0-BETA5](https://packagist.org/packages/issei-m/spike-php#v1.0-BETA5)

The client of  REST api for PHP (5.4+, 7+, HHVM).

Basic Usage
-----------

[](#basic-usage)

First, initialize the `Spike` object with your **api secret key**. It's the entry point for accessing the all api interfaces:

```
$spike = new \Issei\Spike\Spike('your_api_secret_key');
```

### Create a new charge

[](#create-a-new-charge)

To create a new charge, you have to build a `ChargeRequest` object. It can be specified `card token`, `amount`, `currency` and some related products. Next, call `charge()` method with it. If charge succeeded this method will return the new `Charge` object generated by REST api:

```
// The token's id is retrieved by SPIKE Checkout (client side script) usually.
$token = new \Issei\Spike\Model\Token('tok_xxxxxxxxxxxxxxxxxxxxxxxx');

$request = new \Issei\Spike\ChargeRequest();
$request
    ->setToken($token)
    ->setAmount(123.45, 'USD')
    ->setCapture(true) // If you set false, you can delay capturing.
;

$product = new \Issei\Spike\Model\Product('my-product-00001');
$product
    ->setTitle('Product Name')
    ->setDescription('Description of Product.')
    ->setPrice(123.45, 'USD')
    ->setLanguage('EN')
    ->setCount(3)
    ->setStock(97)
;

// The product can be added any times.
$request->addProduct($product);

/** @var $createdCharge \Issei\Spike\Model\Charge */
$createdCharge = $spike->charge($request);
```

Tips: You can pass the `Token`'s id directly instead of generating the new `Token` object:

```
$request->setToken('tok_xxxxxxxxxxxxxxxxxxxxxxxx');
```

**NOTE**: If you want to know how to get a `card token`, read [Request a token](#request-a-token) section.

### Find a charge

[](#find-a-charge)

Call `getCharge()` method with charge id:

```
/** @var $charge \Issei\Spike\Model\Charge */
$charge = $spike->getCharge('20150101-100000-xxxxxxxxxx');
```

### Capture the charge

[](#capture-the-charge)

If you have a charge which has not been captured, you can use `capture()` method to capture it:

```
/** @var $charge \Issei\Spike\Model\Charge */
$capturedCharge = $spike->capture($charge);
```

### Refund the charge

[](#refund-the-charge)

Call `refund()` method with the `Charge` object that you want to refund:

```
/** @var $charge \Issei\Spike\Model\Charge */
$refundedCharge = $spike->refund($charge);
```

Tips: You can pass the `Charge`'s id directly instead of generating/retrieving the `Charge` object:

```
$refundedCharge = $spike->refund('20150101-100000-xxxxxxxxxx');
```

### Retrieve the all charges

[](#retrieve-the-all-charges)

Call `getCharges()` method. it returns an array containing the `Charge` objects.

```
/** @var $charges \Issei\Spike\Model\Charge[] */
$charges = $spike->getCharges();
```

#### Paging

[](#paging)

You can specify the limit of number of records at 1st argument (10 records by default):

```
$charges = $spike->getCharges(5);
```

If you pass a `Charge` object (or ID as a string directly) into 2nd argument, you can retrieve charges that older than (passed charge is NOT included to list):

```
$nextCharges = $spike->getCharges(5, $charges[count($charges) - 1]);
```

At 3rd argument, you can also specify the charge (or ID as a string directly) object if you want to retrieve charges that newer than (passed charge is NOT included to list):

```
$nextCharges = $spike->getCharges(5, $charges[count($charges) - 1], ...);
```

### Request a token

[](#request-a-token)

If you have contracted with  to request a new token, you can get a new token by `requestToken()` method with `TokenRequest`:

```
$request = new \Issei\Spike\TokenRequest();
$request
    ->setCardNumber('4444333322221111')
    ->setExpirationMonth(12)
    ->setExpirationYear(19)
    ->setHolderName('Taro Spike')
    ->setSecurityCode('123')
    ->setCurrency('JPY')
    ->setEmail('test@example.jp')
;

/** @var $charge \Issei\Spike\Model\Token */
$token = $spike->requestToken($request);
```

Of course, you can create a new charge with it:

```
$request = new \Issei\Spike\ChargeRequest();
$request
    ->setToken($token)
    // ...
;

/** @var $charge \Issei\Spike\Model\Charge */
$charge = $spike->charge($request);
```

### Find a token

[](#find-a-token)

Call `getToken()` method with token id:

```
/** @var $token \Issei\Spike\Model\Token */
$token = $spike->getToken('tok_xxxxxxxxxxxxxxxxxxxxxxxx');
```

Installation
------------

[](#installation)

Use [Composer](https://getcomposer.org) to install the package:

```
$ composer require issei-m/spike-php

```

Contributing
------------

[](#contributing)

1. Fork it
2. Create your feature branch
3. Commit your change and push it
4. Create a new pull request

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~260 days

Total

5

Last Release

3145d ago

PHP version history (2 changes)v1.0-BETA1PHP &gt;= 5.4

v1.0-BETA5PHP &gt;= 5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/15c23b5cac78ca616a9ba14846080f7115ec937160ef88b2a902e129b18cc1ea?d=identicon)[issei-m](/maintainers/issei-m)

---

Top Contributors

[![issei-m](https://avatars.githubusercontent.com/u/1135118?v=4)](https://github.com/issei-m "issei-m (83 commits)")[![matsubo](https://avatars.githubusercontent.com/u/98103?v=4)](https://github.com/matsubo "matsubo (1 commits)")

---

Tags

paymentsphprest-apispikerestpaymentsspikespike.cc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/issei-m-spike-php/health.svg)

```
[![Health](https://phpackages.com/badges/issei-m-spike-php/health.svg)](https://phpackages.com/packages/issei-m-spike-php)
```

###  Alternatives

[gopay/payments-sdk-php

GoPay's PHP SDK for Payments REST API

881.7M16](/packages/gopay-payments-sdk-php)[apoca/laravel-sibs-payments

Laravel library to communicate with SIBS - Open Payment Platform.

342.3k](/packages/apoca-laravel-sibs-payments)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
