The PayUMoney Pay library provides convenient access to the PayUMoney API from applications written in server-side JavaScript.
See the PayUMoney API docs.
The package needs to be configured with your account's Merchant Key, Mecrhant Salt and Authorization Key, which are available in your PayUMoney Dashboard.
Install the package with:
npm i payumoney-pay --save
var payumoney = require('payumoney-pay');
payumoney.setAuthData(MODE,MERCHANT_KEY, MERCHANT_SALT, AUTHORIZATION_HEADER,SURL,FURL);
PROD=true TEST=false
that key,which are available in your PayUMoney Dashboard
Set Success url and Failure url
- Create a payment request Will work on PROD AND TEST
- Get Payment Response Will work on PROD
- Check Payment Response Will work on PROD
- Send SMS Invoice Will work on PROD
{
"amount":"xxx",
"firstname":"xxxx",
"email":"xxxx@gmail.com",
"phone":"xxxxxxxx",
"txnid":"xxxxxxxxxxxxxxx"
"productinfo":"xxxx"
}
payumoney.makePayment(body, function(error, response) {
if (error) {
// Some error
} else {
// Payment redirection link
console.log(response);
}
});
{
"txnid":"xxxxxxxxxxxxxxx"
}
payumoney.getPaymentResponse(txnid, function(error, response) {
if (error) {
// Some error
} else {
console.log(response);
}
{
"txnid":"xxxxxxxxxxxxxxx"
}
payumoney.checkPaymentResponse(txnid, function(error, response) {
if (error) {
// Some error
} else {
console.log(response);
}
{
"customerName":"Umesh",
"customerMobileNumber":*****78**,
"description":"Test",
"amount":8000
}
payumoney.sendSMSInvoice(data, function(error, response) {
if (error) {
// Some error
} else {
console.log(response);
}
You can raise an issue Raise.