Skip to content

agarbund/securionpay-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js library for SecurionPay API

Build status

For detailed description of parameters for available methods please visit https://securionpay.com/docs/api

Installation

TODO: library still needs to be published into NPM

npm install securionpay

Quick start

var api = require('securionpay')('pk_test_myprivatekey')

api.customers.create({
    email: 'user@example.com',
    description: 'User description'
}).then(function(customer) {
    return api.cards.create(customer.id, {
        number: '4242424242424242',
        expMonth: '12',
        expYear: '2020',
        cvc: '123',
        cardholderName: 'John Smith'
    });
}).then(function(card) {
    console.log('ID of created card object: ', card.id);
}).catch(function(e) {
    // handle errors here
})

Bluebird is used as Promise library ( http://bluebirdjs.com/ ).

Preferring callbacks? All methods accept callback as their last argument. Promise is not returned when passing callback.

api.customers.create({
    email: 'user@example.com',
    description: 'User description'
}, function(err, customer) {
    if(err) {
        // handle error
    } else {
        // handle response
    }
});

API reference

When params is one of method arguments please refer to detailed API docs (linked) for all available fields

Developing

To connect to different backend:

var api = require('securionpay')('pk_test_myprivatekey', {
    url: 'http://mysecurionenv.com' // without trailing slash
});

To run unit tests and check test coverage:

npm test
npm run check-coverage

To run integration tests:

PRIVATE_KEY=pk_test_myprivatekey npm run integration-test

To run integration tests against environment other than default:

PRIVATE_KEY=pk_test_myprivatekey URL=http://mysecurionenv.com npm run integration-test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.4%
  • Shell 0.6%