tpp-node-sdk
v0.0.5
Published
Tranzakt Payment Gateway Nodejs SDK.
Downloads
26
Maintainers
Keywords
Readme
Tranzakt Payment Platform (TPP) NodeJs SDK
This Node library simplifies access to TPP APIs for your Node applications. It abstracts the complexities of direct integration, enabling you to make quick and easy API calls.
Installation
npm install --save tranzakt-node-sdk
or
yarn add tranzakt-node-sdk
Usage
import Tranzakt from "tranzakt-node-sdk";
const tranzakt = new Tranzakt("secret-key");
or
var Tranzakt = require("tranzakt-node-sdk");
const tranzakt = new Tranzakt("secret-key");
Create static payment invoice
try {
const result = await tranzakt.createInvoice({
collectionId: "37a71e2e-ed54-4e46-a3a9-47a211c352ea",
payerEmail: "[email protected]",
payerName: "John Doe",
payerPhoneNumber: "07078955432",
title: "Checkout Invoice",
billerMetaData: {
"string-1": "any value",
"string-2": "any value",
},
});
console.log(result);
} catch (error) {
console.log(error);
}
Create dynamic payment invoice
try {
const result = await tranzakt.createInvoice({
collectionId: "37a71e2e-ed54-4e46-a3a9-47a211c352ea",
payerEmail: "[email protected]",
payerName: "John Doe",
payerPhoneNumber: "07078955432",
title: "Checkout Invoice",
amount:40000,
invoiceBeneficiaries:
[
{
linkedAccountId: "37a71e2e-ed54-4e46-a3a9-47a211c352ea",
amount: 20000;
},
{
linkedAccountId: 57871e2e-6754-4e46-a3a9-47a211c35cdw;
amount: 20000;
}
]
});
console.log(result);
} catch (error) {
console.log(error);
}
Get invoice details
try {
const result = await tranzakt.getInvoiceDetails(
"22205053-02c7-4607-9cb5-5fa58cecae6d"
);
console.log(result);
} catch (error) {
console.log(error);
}
Testing
All of the libraries tests are run on jest. They can be run by running the test command in your terminal.
npm run test
License
By contributing to this library, you agree that your contributions will be licensed under its MIT license. Copyright (c) TRANZAKT FINANCIAL SERVICES LIMITED.