This page will help you get started with BUSSINESS SDK.
Create npmrc File
Create .npmrc file in React Native project root folder with the following information:
@card91:registry=https://registry.npmjs.org
//registry.npmjs.org/:_authToken=ghp_Access_Token
This files direct npm client to look for all packages starting from @github-banc91 in the registry - https://registry.npmjs.org/
As it is a private repository, it would need a private token to access it (ghp_Access_Token)
Please reach out to Card91 team to get this token
Installation
Install the package using npm
using the following command:
npm install --save-exact @card91/business-sdk
or using yarn
:
yarn add --exact @card91/business-sdk
Usage
Use the method to integrate place you want to use:
Method Name | Description |
---|---|
GetCardDetails | use to fetch card details |
GetCardholderStatus | use to fetch customer status |
LoadFundToCard | use to load money to individual card |
GetAddress | use to fetch customer addresses |
PrintCard | use for coverting virtual card to physical card |
MapCustomerToInstakit | use to map insta kit to customer |
Method_Name(config,payload)
- config: need Object with two property
business token
andenvironment
. - payload: Options for the HTTP(S) request consist of
body
andparams
- Returns: Promise
Important
Please refer "Authentication using JWT' for generating token to be used in this SDK
Config
Initialise Config to setup the environment through below details
{
token: "1J2kjOF65ZXXXXXXXXXXXy0PVngkhnQCbePsdEVc=", // refer section 'Authentication with JWT'
environment: "sandbox",// sandbox or live
},
payload
Refer body for payload .
{
body:
{
orgId: "230526135544169ID1OID4070270",
cardProgramId: "230528190350397ID1CP9723194",
fullName: "Test",
mobile: "918836887364",
email: "[email protected]",
nameOnCard: "Test",
cardMode: "DIGITAL_ONLY_CARD",
printNamedCardBeforeKyc: false,
extraCardHolderRefId: "325CUST538",
extraCardHolderRefDesc: "TEST FIELS",
kitNumber: "220000005820",
addresses: [
{
addressType: "CURRENT_ADDRESS",
address1: "1142,card91 6th main road, sector 7",
address2: "Hsr layout",
pincode: "560102",
city: "Bangalore",
state: "KARNATAKA",
country: "IND",
},
],
documents: [],
},
}
Example
var express = require("express");
var router = express.Router();
const {
CreateCard,
GetCardDetails,
GetCardholderStatus,
LoadFundToCard,
CardLockOrUnlock,
GetAddress,
PrintCard,
MapCustomerToInstakit
} = require("@card91/business-sdk");
/* GET home page. */
router.get("/", function (req, res, next) {
res.render("index", { title: "Express" });
});
//GetCardDetails
router.get("/GetCardDetails", async (req, res, next) => {
try {
const resp = await GetCardDetails(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {},
params: {
cardId: "230613103027508ID1CARD8915520",
},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//GetCardholderStatus
router.get("/GetCardholderStatus", async (req, res, next) => {
try {
const resp = await GetCardholderStatus(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {},
params: {
mobileNo: "918836887364",
},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
// LoadFundToCard
router.get("/LoadFundToCard", async (req, res, next) => {
try {
const resp = await LoadFundToCard(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {
refId: "f6VFxBXeU",
cardId: "220120182337870ID1CARD1480824",
wallets: [
{
walletId: "254a31c0-aff1-491e-ab63-f7b026a15533",
amount: "24",
},
{
walletId: "dc8b0e14-de0a-4ddf-a285-f4d3afe9b78f",
amount: "21",
},
],
},
params: {},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//CardLockOrUnlock
router.get("/CardLockOrUnlock", async (req, res, next) => {
try {
const resp = await CardLockOrUnlock(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {
cardId: "230614093816716ID1CARD1158869",
lock: false,
},
params: {},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//AddAddress
router.get("/AddAddress", async (req, res, next) => {
try {
const resp = await AddAddress(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {
entityId: "230613103027432ID1CUSTID4258560",
entityType: "CUST",
address: {
address1: "1142,card91 6th main road, sector 7",
address2: "Hsr layout",
addressType: "DELIVERY_ADDRESS",
pincode: "560102",
city: "Bangalore",
state: "KARNATAKA",
country: "IND",
},
},
params: {},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//GetAddress
router.get("/GetAddress", async (req, res, next) => {
try {
const resp = await GetAddress(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {},
params: {
customerId: "230613103027432ID1CUSTID4258560",
},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//PrintCard
router.get("/PrintCard", async (req, res, next) => {
try {
const resp = await PrintCard(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {
"cardId":"230614093816716ID1CARD1158869",
"nameOnCard":"activecardcheck",
"addressId":20297
},
params: {},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
//MapCustomerToInstakit
router.get("/MapCustomerToInstakit", async (req, res, next) => {
try {
const resp = await MapCustomerToInstakit(
{
token: "1J2kjOF65Z6FHLNeSKqMA9mUy0PVngkhnQCbePsdEVc=",
environment: "sandbox",
},
{
body: {
"kitNumber": "230000070080",
"mobile": "916728065319",
"orgId" :"230509105814076ID1OID4457878",
"cardProgramId": "230509110159460ID1CP8610546"
},
params: {},
}
);
console.log("res", resp, resp.status);
const data = await resp.json();
console.log("data", data);
res.render("index", { title: JSON.stringify(data) });
// if(resp.status ===200){
// res.send(JSON.string(data))
// }
// else{
// res.send(JSON.string(data))
// }
} catch (e) {
res.send(`Error ${e}`);
}
});
module.exports = router;