Make sure you have signed up for your Payabbhi Account and downloaded the API keys from the Portal.
Node.js v7.6.0 and later.
Install the package with:
npm install payabbhi --save
Please refer to:
A typical usage of the Payabbhi Node Library is shown below:
const payabbhi = require('payabbhi')('<your-access-id>', '<your-secret-key>');
payabbhi.orders.create({
merchant_order_id: "ORD_001",
amount: 10000,
currency: "INR"
}, (error, order) => {
// error will be null if no error occurred
// order is the created order object
});
Payabbhi Node library provides utility functions for verifying the payment signature received in the payment callback.
payabbhi.verifyPaymentSignature({
"order_id": "<order-id>",
"payment_id": "<payment-id>",
"payment_signature": "<payment-signature>"
});
Payabbhi Node library provides an utility function for webhook signature verification.
// replayInterval is optional. Default value is 300 seconds.
payabbhi.verifyWebhookSignature('<payload>','<actualSignature>', '<secret>', <replayInterval>);
Payabbhi Node library supports the Promise API. Every method returns a promise which can be used instead of callbacks.
A typical usage of the library with promises is shown below:
payabbhi.orders.create({
merchant_order_id: "ORD_001",
amount: 10000,
currency: "INR"
}).then(function (order) {
...
}).catch(function (error) {
...
});