securionpay

2.1.0 • Public • Published

Node.js library for SecurionPay API

Build

Installation

npm install securionpay

Quick start

const api = require('securionpay')('sk_test_my_secret_key');
(async () => {
  try {
    const customer = await api.customers.create({
      email: 'user@example.com',
      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

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

Readme

Keywords

Package Sidebar

Install

npm i securionpay

Weekly Downloads

128

Version

2.1.0

License

MIT

Unpacked Size

20.8 kB

Total Files

22

Last publish

Collaborators

  • securionpay