securionpay

Node.js wrapper for SecurionPay API

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
securionpay
2.1.02 years ago8 years agoMinified + gzip package size for securionpay in KB

Readme

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
  • charges
- create(params) - get(chargeId) - update(chargeId, params) - capture(chargeId) - refund(chargeId, params) - list(params)
  • customers
- create(params) - get(customerId) - update(customerId, params) - delete(customerId) - list(params)
  • cards
- create(customerId, params) - get(customerId, cardId) - update(customerId, cardId, params) - delete(customerId, cardId) - list(customerId, params)
  • subscriptions
- create(params) - get(subscriptionId) - update(subscriptionId, params) - cancel(subscriptionId, params) - list(params)
  • plans
- create(params) - get(planId) - update(planId, params) - delete(planId) - list(params)
  • events
- get(eventId) - list(params)
  • tokens
- create(params) - get(tokenId)
  • blacklist
- create(params) - get(blacklistRuleId) - delete(blacklistRuleId) - list(params)
  • checkoutRequest
- sign(checkoutRequestObjectOrJson)
  • crossSaleOffers
- create(params) - get(crossSaleOfferId) - update(crossSaleOfferId, params) - delete(crossSaleOfferId) - list(params)
  • credits
- create(params) - get(creditId) - update(creditId, params) - list(params)
  • disputes
- get(disputeId) - update(disputeId, params) - close(disputeId) - list(params)
  • fileUploads
- upload(content, params) - get(fileUploadId) - list(params)
  • fraudWarnings
- get(fraudWarningId) - list(params)
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