Install
You can install the Node.js API Library, by running the following command.
npm install checkbook-api --save
Configuration
The package needs to be configured with your account's API Key and API Secret. The API credentials below are from the demo
environment and you can use them to try the API.
var CheckbookAPI = require('checkbook-api');
var Checkbook = new CheckbookAPI({
api_key: 'd6aa2703655f4ba2af2a56202961ca86',
api_secret: 'dXbCgzYBMibj8ZwuQMd2NXr6rtvjZ8',
env: 'demo'
});
The env
parameter is optional and can be omitted if the requests are made to the live environment. The possible values for this parameter are demo
or sandbox
and the API credentials need to be from the specified environment.
Usage
You can use the following code snippet to send a digital check.
More code samples can be founds here.
Checkbook.checks.sendDigitalCheck({
name: 'Widgets Inc.',
recipient: '[email protected]',
description: 'Test Send Check',
amount: 10.00
}, function (error, response) {
if (error) {
console.log('Error:', error);
} else {
console.log('Response:', response);
}
});