Skip to content

Instantly share code, notes, and snippets.

@rootedsoftware
Created January 20, 2015 18:43
Show Gist options
  • Save rootedsoftware/6e610514705c503c1118 to your computer and use it in GitHub Desktop.
Save rootedsoftware/6e610514705c503c1118 to your computer and use it in GitHub Desktop.
Balanced debit get
// Import the official balanced nodejs package
var balanced = require('balanced-official');
// Create a new API Key and configure the client with it
// The client automatically creates a new test marketplace for us
// if a marketplace does not exist for the api key
balanced.configure(apikey);
// Create a customer with some dummmy data
balanced.get('https://api.balancedpayments.com/debits/WD5rJ4kojAowU1YW4pz86Tb').then(function(debit) {
// Prints the debit
print(debit);
}, function(err) {
print('Error Getting Debit!');
print(err);
});
// Nicely print a formatted json representation of the object
function print(obj) {
console.log('string' === typeof obj ? obj : JSON.stringify(obj, null, 4));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment