Skip to content

Instantly share code, notes, and snippets.

@rserna2010
Created January 20, 2015 19:20
Show Gist options
  • Save rserna2010/26ebdd8a3e9511f98e35 to your computer and use it in GitHub Desktop.
Save rserna2010/26ebdd8a3e9511f98e35 to your computer and use it in GitHub Desktop.
// 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('ak-test-1xGEmbY58peQpnsgKEpgjuXgR1TjYdGpj');
// Create a customer with some dummmy data
balanced.get('/debits/WDwXsVosniVmJBcxO7IfTFj').then(function(customer) {
// Prints the newly created customer
print(customer);
}, function(err) {
print('Error Creating Customer!');
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