Nodejs library to accept bKash payments on your backend application
MIT License
Nodejs library to accept bkash payments on your backend application
vscode
vscode
30 seconds
and get an error so that you can query the paymentin progress
npm
npm install bkash-payment-gateway
yarn
yarn add bkash-payment-gateway
javascript
file
bkash.js
const { BkashGateway } = require('bkash-payment-gateway');
const bkashConfig = {
baseURL: 'https://checkout.sandbox.bka.sh/v1.2.0-beta', //do not add a trailing slash
key: 'abcdxx2369',
username: 'bkashTest',
password: 'bkashPassword1',
secret: 'bkashSup3rS3cRet',
};
const bkash = new BkashGateway(config);
module.exports = bkash;
typescript
file
bkash.ts
import { BkashGateway ICreatePayment } from 'bkash-payment-gatway';
const bkashConfig: ICreatePayment = {
//get intellisense here
baseURL: 'https://checkout.sandbox.bka.sh/v1.2.0-beta', //do not add a trailing slash
key: 'abcdxx2369',
username: 'bkashTest',
password: 'bkashPassword1',
secret: 'bkashSup3rS3cRet',
};
const bkash = new BkashGateway(config);
export default bkash;
const paymentRequest = {
amount: 1000,
orderID: 'ORD1020069',
intent: 'sale',
};
const result = await bkash.createPayment(paymentRequest);
console.log(result);
const result = await bkash.executePayment('<Payment ID returned by bkash>');
const result = await bkash.queryPayment('<Payment ID returned by bkash>');
const result = await bkash.searchTransaction('TRX22347463XX');
const refundTransactionData = {
paymentID: '22423169',
amount: '25.69', //do not add more than two decimal points
trxID: 'TRX22347463XX';
sku: 'SK256519';
}
const result = await bkash.refundTransaction(refundTransactionData);
const result = await bkash.refundStatus('TRX22347463XX', '12437969');
issues
or pull request
for any issues and bugfixesproject
section of the github repositoryMIT
DISCLAIMER: This software comes with absolutely no warranty and is not affiliated with the company
Bkash
in any way. Use at your own risk. Author and Contributors are not responsible for any financial damages, outages etc.