Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Latest commit

 

History

History
154 lines (132 loc) · 5.96 KB

README.md

File metadata and controls

154 lines (132 loc) · 5.96 KB

Deprecation

This library is deprecated. Please use Shift4 Node.js Library.

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