paymentrails
A JavaScript SDK (written in TypeScript) - For more information about the API as well as NodeJS code samples check out the [full API documentation](http://docs.paymentrails.com)
Last updated 4 months ago by koblas .
ISC · Original npm · Tarball · package.json
$ cnpm install paymentrails 
SYNC missed versions from official npm registry.

Payment Rails JavaScript SDK

A JavaScript SDK (written in TypeScript) - For more information about the API as well as NodeJS code samples check out the full API documentation

Installation

npm install --save paymentrails

Getting Started

The Payment Rails API is built using promises and all methods except connect will return a promise. The connect call allows you to setup your API Key and Secret with a client that can be used for subsequent calls.

// A simple application using the Payment Rails SDK
const paymentrails = require('paymentrails');

const client = paymentrails.connect({
  key: "YOUR-API-KEY",
  secret: "YOUR-API-SECRET",
  environment: "production",
});

// Async/Await version

async function main() {
  const recipient = await client.recipient.find("R-G7SXXpm6cs4aTUd9YhmgWC");
  console.log(recipient.id);
}

main();

// Promise version

client.recipient.find("R-G7SXXpm6cs4aTUd9YhmgWC").then(recipient => {
  console.log(recipient.id);
}).catch(err => {
  console.log("ERROR", err);
});

Usage

Methods should all have JSDoc comments to help you understand their usage. As mentioned the full API documentation is the best source of information about the API.

For more information please read the JavaScript API docs is available. The best starting point is:

Data Type SDK Documentation
Batch API Docs for Batch
Payment API Docs for Payment
Recipient API Docs for Recipient
Recipient Account API Docs for Recipient Account

Running Integration / Unit tests

If you're working on the library itself, here's easy way to run the unit tests. They are designed to be run with configuration coming through environment variables.

  • PR_ACCESS_KEY
  • PR_SECRET_KEY
  • PR_ENVIRONMENT

For a command like:

PR_ACCESS_KEY=xxx \
PR_SECRET_KEY=yyy \
PR_ENVIRONMENT=integration \
npm run test:integration

Current Tags

  • 0.9.7                                ...           latest (4 months ago)

10 Versions

  • 0.9.7                                ...           4 months ago
  • 0.9.6                                ...           a year ago
  • 0.9.5                                ...           a year ago
  • 0.9.4                                ...           a year ago
  • 0.9.3                                ...           a year ago
  • 0.9.2                                ...           a year ago
  • 0.9.1                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 11
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (17)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |