1.0.0 • Published 7 years ago

spryngpayments v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

Spryng Payments for NodeJS

This is the official Spryng Payments Node JS package. It is installed through NPM:

npm install spryngpayments

Then use it as follows:

// Initiate using API Key + boolean to enable sandbox mode.
var SpryngPayments = require('SpryngPayments')('Your_API_Key', true);

// List transactions
SpryngPayments.transaction.list(function(data) {
	for (var trx in data) {
		console.log('Transaction: ' + trx._id);
	}
});

// Get a single transaction
SpryngPayments.transaction.get('ABC123', function(data) {
	console.log('The amount was ' + data.amount);
});

// Initiate a new transaction
var trx = {
	account: 'ACC_001',
	amount: 1000,
	dynamic_description: 'TRX_001',
	customer_ip: '127.0.0.1',
	customer: 'CUST_001',
	card: 'CRD_001',
	user_agent: 'blablabla'
};
SpryngPayments.transaction.create(trx, function(data) {
	console.log('Status: ' + data.status);
});

// These functions work the same way for customers, accounts, etc
SpryngPayments.account.get('ACC_001', function(data) {
	console.log('Account name: ' data.name);
});