ascca-token-client

API client for token processing by connecting to assca

Usage no npm install needed!

<script type="module">
  import asccaTokenClient from 'https://cdn.skypack.dev/ascca-token-client';
</script>

README

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