trupay
v1.0.3
Published
Trupay Payment Gateway Api
Downloads
5
Readme
This is the API of TRUPAY
Installation
Using NPM npm install trupay
Usage
You need a valid Salt and Merchant Id from Trupay
Code
const Trupay = require('trupay');
var trupay = new Trupay({'token':<A VALID TOKEN>,'salt':<A VALID SALT>,'base_url':<URL OF API>});
app.post('/getOneTimeWebSessionKey', function (req, res) {
var params= {
"MERCH_ORDER_ID": req.body.MERCH_ORDER_ID,
"TXN_AMOUNT" : req.body.TXN_AMOUNT,
"RET_URL_SUCC" : req.body.RET_URL_SUCC,
"REQUEST_ID" : req.body.REQUEST_ID,
"MERCH_CUST_NUMBER" : req.body.MERCH_CUST_NUMBER,
"MERCH_CUST_EMAIL" : req.body.MERCH_CUST_EMAIL,
"MERCH_CUST_ID" : req.body.MERCH_CUST_ID,
"COLLECTOR_ID" : req.body.COLLECTOR_ID,
"RET_URL_FAIL" : req.body.RET_URL_FAIL,
"PARAM1" : req.body.PARAM1,
"PARAM2" : req.body.PARAM2,
"PARAM3" : req.body.PARAM3,
"PARAM4" : req.body.PARAM4,
"PARAM5" : req.body.PARAM5
};
trupay.getOneTimeWebSessionKey(params).then((result) => {
return res.json(result)
})
})
//-----This route is the success url which will verify your transaction
app.post('/successURL', function (req, res) {
var params= {
"MERCH_ORDER_ID": req.body.MERCH_ORDER_ID,
"TXN_ID" : req.body.TXN_ID,
"REQUEST_ID" : req.body.REQUEST_ID,
"PARAM1" : req.body.PARAM1,
"PARAM2" : req.body.PARAM2,
"PARAM3" : req.body.PARAM3,
"PARAM4" : req.body.PARAM4,
"PARAM5" : req.body.PARAM5
};
trupay.merchantRequestStatus(params).then((result) => {
return res.json(result)
})
})
NOTE:- THE RETURN URL SHOULD CALL THE SECOND API CALL THAT IS trupay.merchantRequestStatus().