ascca-token-client

1.2.0 • Public • Published

ascca-token-client

Build Status

AsccaTokenClient is a JavaScript library for GMO Payment Gateway token settlement.

Installation

npm install ascca-token-client

Usage

class AsccaTokenClient

Client for tokenization. Initialization by passing shopId and options.

const AsccaTokenClient = require("ascca-token-client").AsccaTokenClient;
const asccaTokenClient = new AsccaTokenClient(shopId, options = {production: false});

getToken(cardNumber, cardExpired)

Passing cardNumber and cardExpired will return a token. The cardExpired(expiration date) format is "YYMM".

const asccaTokenClient = new AsccaTokenClient('testshopid000000');
 
asccaTokenClient.getToken('4111111111111111', '2210').then((value) => {
  console.log(value);
}, (error) => {
  console.error("error:", error);
});

url

The production or test URL will be returned.

const asccaTokenClient1 = new AsccaTokenClient("testshopid000000");
 
// test URL is returned
asccaTokenClient1.url;
 
const asccaTokenClient2 = new AsccaTokenClient("testshopid000000", options = {production: true});
 
// production URL is returned
asccaTokenClient2.url;

Sample

For browsers.

git clone git@github.com:kurotaky/ascca-token-client.git
cd ascca-token-client
npm i
npm run build
npm run webpack
open sample.html

Try putting your card number and expiration date in form.

License

MIT

Package Sidebar

Install

npm i ascca-token-client

Weekly Downloads

183

Version

1.2.0

License

MIT

Unpacked Size

32 kB

Total Files

14

Last publish

Collaborators

  • kurotaky