GiftRocket gift card API for node.js
JavaScript Makefile
Latest commit 0f04b5a Nov 17, 2016 @ben-rocket ben-rocket v1.1.0
Permalink
Failed to load latest commit information.
lib v1.1.0 Nov 16, 2016
.gitignore v1.0.0 Nov 11, 2016
LICENSE v1.0.0 Nov 11, 2016
Makefile v1.0.0 Nov 11, 2016
README.md One liner in README Nov 11, 2016
index.js v1.0.0 Nov 11, 2016
package.json v1.1.0 Nov 16, 2016

README.md

giftrocket-node

A node.js client library for the GiftRocket API.

Installation

$ npm install giftrocket

Getting started

All API requests require an access token. A sandbox access token is assigned upon signup through the GiftRocket Dashboard. Once you are ready to move to production, you will be assigned a production access token.

Authentication

var GiftRocket = require('giftrocket');
var client = new GiftRocket("[YOUR_ACCESS_TOKEN]");

Orders

See API documentation for all Order options. Use the FoundingSources resource to look up a valid method for your payment (i.e. credit card, ACH, etc).

// Create a new order, specifying your gift options
// as an array of objects.
client.createOrder({
  "funding_source_id": "[FUNDING_SOURCE_ID]",
  "gifts": [
    {
      "amount": 40,
      "message": "Such a great way to show appreciation to others!",
      "recipient": {
        "email": "person@yourteam.com",
        "name": "Person Example"
      },
      "style_id": "thank_you_tree"
    }
  ]
}, function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});

// Return historical orders, optionally passing a starting offset for results.
client.getOrders({offset: 10}, function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});

// Return a order by order_id
client.getOrder("[ORDER_ID]", function(err, result) {
  console.log(JSON.stringify(result, null, 2));
});

Funding Sources

Production funding sources must be added through the web dashboard. A sandbox funding source is provided during development.

// Retrieve a list of your funding sources (credit card, ach, etc).
client.getFundingSources(function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});

Styles

A style defines the presentation of your gift. The styles endpoint returns an array of card designs.

client.getStyles(function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});

Gifts

Retrieve a single or many historical gifts sent by your account.

client.getGifts({offset: 10}, function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});

client.getGift("[GIFT_ID]", function(err, results) {
  console.log(JSON.stringify(results, null, 2));
});