Payment Rails JavaScript SDK for v1 API
Switch branches/tags
Nothing to show
Clone or download
koblas Update packages to avoid security warning
* Update packages to avoid security warning

* bump version

* fix dependancy locations

* fix comma

* Fixed tests for TS2.8

* Updated build to work
Latest commit a0edc3c Apr 27, 2018
Permalink
Failed to load latest commit information.
.circleci disable circleci test Jan 28, 2018
docs Update packages to avoid security warning Apr 27, 2018
lib Updated the docs and centralized the URL generation Jan 30, 2018
test Update packages to avoid security warning Apr 27, 2018
.gitignore
.prettierrc Reworked the API Jan 28, 2018
README.md Updated top level README Jan 30, 2018
package-lock.json Update packages to avoid security warning Apr 27, 2018
package.json Update packages to avoid security warning Apr 27, 2018
tsconfig.json Update packages to avoid security warning Apr 27, 2018
tslint.json Reworked the API Jan 28, 2018

README.md

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