npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bkash-payment-gateway

v2.0.1

Published

Bkash Payment Gateway Library to accept payments on your node.js backend

Downloads

152

Readme

bkash-payment-gateway

Nodejs library to accept bkash payments on your backend application

CodeQL Test for linting and formatting Publish to NPM and Github Packages

Examples

Features

  • Implements all the methods required to get accepted as a merchant on bKash
  • Written in typescript
  • Get intellisense in when interacting with the library vscode
  • Get Documentation and examples right inside your code editor vscode
  • Get Bkash Response Intellisense
  • Abort Request when an executePayment request exceeds 30 seconds and get an error so that you can query the payment
  • Get Human Readable exceptions when some error response is returned from bKash in progress

How to use

Installing the library

npm

npm install bkash-payment-gateway

yarn

yarn add bkash-payment-gateway


Initializing the library

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;

Create a payment

const paymentRequest = {
	amount: 1000,
	orderID: 'ORD1020069',
	intent: 'sale',
};

const result = await bkash.createPayment(paymentRequest);
console.log(result);

Execute a payment with payment ID

const result = await bkash.executePayment('<Payment ID returned by bkash>');

Query a payment with payment ID

const result = await bkash.queryPayment('<Payment ID returned by bkash>');

Search Transaction

const result = await bkash.searchTransaction('TRX22347463XX');

Refund a transaction

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);

Check Refund Status

const result = await bkash.refundStatus('TRX22347463XX', '12437969');

Contributing

  • Please Follow the code style and use the prettier config and eslint config provided in the repository
  • Feel free to open issues or pull request for any issues and bugfixes
  • If you want to implement new features or write documentation about existing features feel free to do it as well
  • To see a list of missing features or to-do's, please visit the project section of the github repository

License

MIT

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.

Author

Shahriar Shojib