README
SNAPCARD
Node.js client library for the Snapcard API.
Install
npm install snapcard
Usage
var snapcard = require('snapcard')({
apiKey: 'a8OLGw7rrzsVjK8soHSnKOjLmqDGCTKW',
secretKey: 'f7f09FbpEIjzBlRNT2yTfZVmZ0cBqpx0'
});
snapcard('GET', 'account')
.then(function(data) {
// .. success
},
function(data) {
// .. error
});
snapcard('GET', 'transactions', {
limit: 1,
offset: 1
})
.then(successCallback, errorCallback);
snapcard('POST', 'transfers', {
sourceAmount: '0.01',
sourceCurrency: 'BTC',
dest: 'email:test@snapcard.io'
})
.then(successCallback, errorCallback);
Ability to override options used by the Request client on both constructor and per invocation:
var snapcard = require('snapcard')({
apiKey: 'a8OLGw7rrzsVjK8soHSnKOjLmqDGCTKW',
secretKey: 'f7f09FbpEIjzBlRNT2yTfZVmZ0cBpqx0',
options: {
timeout: 1500
}
});
snapcard('GET', 'rates', {}, {
timeout: 1500
})
.then(successCallback, errorCallback);
Errors
Example error response:
{
"language":"en",
"subType":"INVALID_VALUE",
"problematicField":"dest",
"problematicValue":"asdf",
"exceptionId":"CvjMPW",
"compositeType":"ValidationException.INVALID_VALUE",
"message":"asdf is not a valid value for dest",
"type":"ValidationException",
"transient":false
}