@fisshboneandlestr/cashtoken-node-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i @fisshboneandlestr/cashtoken-node-sdk

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

30.2 kB

Total Files

12

Last publish

Collaborators

  • iyiolapeter