securionpay
v2.1.0
Published
Node.js wrapper for SecurionPay API
Downloads
552
Readme
Node.js library for SecurionPay API
Installation
npm install securionpay
Quick start
const api = require('securionpay')('sk_test_my_secret_key');
(async () => {
try {
const customer = await api.customers.create({
email: '[email protected]',
description: 'User description'
})
console.log('ID of created customer object: ', customer.id);
const card = await api.cards.create(customer.id, {
number: '4242424242424242',
expMonth: '12',
expYear: '2025',
cvc: '123',
cardholderName: 'John Smith'
})
console.log('ID of created card object: ', card.id);
const charge = await api.charges.create({
amount: 1000,
currency: "EUR",
card: card.id,
customerId: customer.id
});
console.log('ID of created charge object: ', charge.id);
} catch (e) {
console.error(e)
// handle errors
}
})();
API reference
Please refer to detailed API docs (linked) for all available fields
- charges
- customers
- cards
- subscriptions
- plans
- events
- tokens
- blacklist
- checkoutRequest
- crossSaleOffers
- credits
- disputes
- fileUploads
- fraudWarnings
For further information, please refer to our official documentation at https://securionpay.com/docs.
Developing
To connect to different backend:
var api = require('securionpay')({
secretKey: 'sk_test_my_secret_key',
apiUrl: 'https://api.mysecurionenv.com',
uploadsUrl: 'https://uploads.mysecurionenv.com'
});
To run tests:
SECRET_KEY=sk_test_my_secret_key npm run test
To run style check:
npm run stylecheck