npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

spike-api

v0.7.1

Published

SPIKE REST API client library for node.js

Downloads

16

Readme

SPIKE REST API for Node.js

An asynchronous client library for the SPIKE REST API.

Build Status Code Climate coverrage npm version dependencies license MIT

var SpikeAPI = require('spike-api').SpikeAPI;

var client = new SpikeAPI({
  secretKey: 'YOUR_SECRET_KEY'
});

client.getChargeList(function(err, result) {
  if (!err) {
    console.log(result);
  }
});

Installation

npm install spike-api

Post a new Charge

POST https://api.spike.cc/v1/charges

var Product = require('spike-api').Product;

// new charge data
var newCharge = {
  currency: 'JPY'; // 'JPY' or 'USD'
  amount: 1080,
  card: 'CARD_TOKEN', // Token that has been acquired in SPIKE Checkout.
  products: 
    new Product({
      id: '0001',
      title: 'product A',
      description: 'desc',
      price: 1000,
      currency: 'JPY',
      count: 1,
      stock: 100
    })
  ]
};

// POST https://api.spike.cc/v1/charges
client.postCharge(newCharge, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{
  "id": "20140609-064331-onjmfi1z5q",
  "object": "charge",
  "created": 1402375175,
  "livemode": false,
  "paid": true,
  "captured": true,
  "amount": 1080,
  "currency": "JPY",
  "refunded": false,
  "amount_refunded": null,
  "refunds": []
}

Get a Charge info

GET https://api.spike.cc/v1/charges/{CHARGE_ID}

var chargeID = '20140609-064331-onjmfi1z5q';

// GET https://api.spike.cc/v1/charges/{CHARGE_ID}
client.getCharge(chargeID, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{
  "id": "20140609-064331-onjmfi1z5q",
  "object": "charge",
  "created": 1402375175,
  "livemode": false,
  "paid": true,
  "captured": true,
  "amount": 1900,
  "currency": "JPY",
  "refunded": false,
  "amount_refunded": null,
  "refunds": []
}

Refund a Charge

POST https://api.spike.cc/v1/charges/{CHARGE_ID}/refund

var chargeID = '20140609-064331-onjmfi1z5q';

// POST https://api.spike.cc/v1/charges/{CHARGE_ID}/refund
client.refundCharge(chargeID, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{
  "id": "20140609-064331-onjmfi1z5q",
  "object": "charge",
  "livemode": false,
  "created": 1400220648,
  "paid": false,
  "captured": true,
  "amount": 100,
  "currency": "USD",
  "refunded": true,
  "amount_refunded": 100,
  "refunds": [
    {
      "object": "refund",
      "created": 1400220648,
      "amount": 100,
      "currency": "USD"
    }
  ]
}

Get Charge List

GET https://api.spike.cc/v1/charges

// Acquisition number of list
var limit = 2;

// GET https://api.spike.cc/v1/charges
client.getChargeList(limit, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{
  "object": "list",
  "url": "/v1/charges",
  "has_more": false,
  "data": [
    {
      "id": "20140609-064331-onjmfi1z5q",
      "object": "charge",
      "created": 1402375175,
      "livemode": false,
      "paid": true,
      "captured": true,
      "amount": 1900,
      "currency": "JPY",
      "refunded": false,
      "amount_refunded": null,
      "refunds": []
    },
	{
      "id": "20140609-064332-xijafi4p6x",
      "object": "charge",
      "created": 1402375275,
      "livemode": false,
      "paid": true,
      "captured": true,
      "amount": 1080,
      "currency": "JPY",
      "refunded": false,
      "amount_refunded": null,
      "refunds": []
    }
  ]
}

Post Token

POST https://api.spike.cc/v1/tokens

var newCard = {
  'card[number]': 4444333322221111,
  'card[exp_month]': 1,
  'card[exp_year]': 2020,
  'card[cvc]': 111,
  'card[name]': 'KATSUAKI SATO',
  'currency': 'JPY'
};

// POST https://api.spike.cc/v1/charges
client.postToken(cardData, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{ 
  "id": "tok_xEI0RJWqwC3HqO0TQOxoGRgx",
  "object": "token",
  "created": 1435069120,
  "livemode": false,
  "type": "card",
  "source": 
  { 
    "object": "card",
    "last4": "1111",
    "brand": "Visa",
    "exp_month": 1,
    "exp_year": 2020,
    "name": "KATSUAKI SATO" 
  } 
}

Get Token

GET https://api.spike.cc/v1/tokens/{TOKEN_ID}

// POST https://api.spike.cc/v1/charges
client.getToken(cardToken, function(err, result) {
  if (!err) {
    console.log(result);
  }
});

result example:

{ 
  "id": "tok_xEI0RJWqwC3HqO0TQOxoGRgx",
  "object": "token",
  "created": 1435069120,
  "livemode": false,
  "type": "card",
  "source": 
  { 
    "object": "card",
    "last4": "1111",
    "brand": "Visa",
    "exp_month": 1,
    "exp_year": 2020,
    "name": "KATSUAKI SATO" 
  } 
}

SPIKE API Reference

https://spike.cc/dashboard/developer/docs/api_reference

Contributors

License

MIT License. ©2015 Yuhta Nakajima