@fisshboneandlestr/cashtoken-node-sdk
CashToken NodeJS SDK
Last updated 8 months ago by iyiolapeter .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @fisshboneandlestr/cashtoken-node-sdk 
SYNC missed versions from official npm registry.

cashtoken-node-sdk

CashToken NodeJS SDK for Gifting CashTokens

Installation

$ npm install --save @fisshboneandlestr/cashtoken-node-sdk

Usage

import { CashToken } from "@fisshboneandlestr/cashtoken-node-sdk"

or

const { CashToken } = require("@fisshboneandlestr/cashtoken-node-sdk")

Test Keys

const PUBLIC_KEY = "TESTPUBLICKEY01";
const PRIVATE_KEY = "YEKCILBUPTSET6NOITCES";

Instantiate

const cashToken = CashToken.V1({
    privateKey: PRIVATE_KEY, //your private key
    publicKey: PUBLIC_KEY, //your public key
    env: "staging", //or production
    trace: true // or false, determines whether to log request and response to console, you may also pass your own logging function instead
});

Get Access Token

const response = await cashToken.getAccessToken({
    data: {
        userPhoneNo: "MY PHONE NUMBER",
        userPin: "MY PASSWORD"
    }
});

console.log(response.status); // succeeded or failed
console.log(response.message); // response message
if(response.isOk){ // all is well, correct response, we have access token
    console.log(response.data.userId);
    console.log(response.data.accessToken);
}

Gift CashToken

const response = cashToken.giftCashToken({
    userId: "MY USER ID", //user id gotten from getAccessToken call
    accessToken: "ACCESS TOKEN" //access token gotten from getAccessToken call,
    data: {
        customerPhoneNo: "09011112222",
        quantity: 10,
        reason: 'SDK Test'
    }
});

console.log(response.status); // succeeded or failed
console.log(response.message); // response message

Current Tags

  • 1.0.2                                ...           latest (8 months ago)

3 Versions

  • 1.0.2                                ...           8 months ago
  • 1.0.1                                ...           8 months ago
  • 1.0.0                                ...           8 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (2)
Dev Dependencies (11)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |