Socket
Book a DemoInstallSign in
Socket

payon

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

payon

Payon server-to-server SDK.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Payon

Travis build status Coveralls NPM version Canonical Code Style Twitter Follow

Payon server-to-server SDK.

In its current state, the SDK is designed for the use with a specific application. However, should you have a use case that is not covered by the SDK, please raise an issue and I am happy to help.

Usage

Payon SDK is using Flow type annotations and JSON schemas to guide/ enforce the shape of the request and response.

import Payon from 'payon';
import type {
  AuthenticationType,
  PaymentType
} from 'payon';

const apiUrl = 'https://test.oppwa.com/v1/';

/**
 * The test credentials are taken from https://docs.payon.com/tutorials/server-to-server.
 */
const authentication: AuthenticationType = {
  entityId: '8a829418571dad0401571e262e320b32',
  password: 'TPs5pfgH8e',
  userId: '8a829418571dad0401571e262ef80b36'
};

const client = new Payon(apiUrl, authentication);

const paymentPayload: PaymentType = {
  amount: '1.00',
  card: {
    cvv: '123',
    expiryMonth: '05',
    expiryYear: '2020',
    holder: 'Jane Jones',
    number: '4200000000000000'
  },
  currency: 'GBP',
  paymentBrand: 'VISA',
  paymentType: 'PA'
};

const paResponse = await client.createPayment(paymentPayload);

Handling errors

  • A malformed request results in a MalformedRequestError error.
  • A response with a result code other than success results in a PayonRemoteError error.

Keywords

gateway

FAQs

Package last updated on 31 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts