Implemented paytm payment logic in nodejs. After successful payment it is not redirecting to success message simply it is showing "Redirect back to the page" in prod environment. Below is my code. Also attached screenshot. Please help me if i miss anything.enter image description here
app.post('/payment', urlencodedParser, (req,res)=>{
let reqbody = req.body;
let orderId = 'order_'+ Math.random().toString(36).substring(7);
let params = {}
params['MID'] = 'My Merchant Id',
params['WEBSITE'] = 'DEFAULT',
params['CHANNEL_ID'] = 'WEB',
params['INDUSTRY_TYPE_ID'] = 'Retail',
params['ORDER_ID'] = orderId,
params['CUST_ID'] = 'CUST' + Math.random().toString(36).substring(7),
params['TXN_AMOUNT'] = '1',//+reqbody.money+'',
params['CALLBACK_URL'] = 'https://securegw.paytm.in/theia/paytmCallback?ORDER_ID='+orderId+'',
params['EMAIL'] = 'myemail@gmail.com',
params['MOBILE_NO'] = '9999999999',
checksum_lib.genchecksum(params, '9KBKBVjiB3ml5TSP', function(err, checksum){
let txn_url = 'https://securegw.paytm.in/order/process';
let form_fields =''
for(x in params){
form_fields +="<input type='hidden' name = '"+x+"' value = '"+params[x]+"'/>"
}
form_fields +="<input type='hidden' name = 'CHECKSUMHASH' value = '"+checksum+"' />"
var html = '<html><body><center><h1>Please wait! Do not refresh the page </h1></center><form method="post" action="'+txn_url+'" name="f1">'+form_fields+'<script type="text/javascript">document.f1.submit()</script></body></html>'
res.writeHead(200, {'Content-Type':'text/html'})
res.write(html)
res.end()
})
})
Please use your own call back URL instead of https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=. Above call back URL work only for app. So you need to replace your own call back URL in the parameter params['CALLBACK_URL'].