Node.js Library for accepting payments from Nagad
MIT License
Nodejs library to accept nagad payments on your backend application
TSDoc
commentsnpm
npm install nagad-payment-gateway
yarn
yarn add nagad-payment-gateway
javascript
file
nagad.js
const { NagadGateway } = require('nagad-payment-gateway');
const config = {
apiVersion: 'v-0.2.0',
baseURL: process.env.BASE_URL,
callbackURL: process.env.CALLBACK_URL,
merchantID: process.env.MERCHANT_ID,
merchantNumber: process.env.MERCHANT_NUMBER,
privKey: '.keys/private.key',
pubKey: '.keys/public.key',
isPath: true,
};
const nagad = new NagadGateway(config);
module.exports = nagad;
typescript
Todo
try {
const nagadURL = await nagad.createPayment({
// -> get intellisense here
amount: '100',
ip: '10.10.0.10',
orderId: `${Date.now()}`,
productDetails: { a: '1', b: '2' },
clientType: 'PC_WEB',
});
//redirect user to the nagad url
} catch (err) {
console.log(err);
}
try {
const nagadURL = await nagad.verifyPayment(paymentRefID);
//redirect user to the nagad url
} catch (err) {
console.log(err);
}
More documentation coming soon
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
Nagad
in any way. Use at your own risk. Author and Contributors are not responsible for any financial damages, outages etc.