Error integrating payUMoney in nodejs

I am trying to integrate payumoney in node.js but I am getting an error like

Required parameters that must be sent in the transaction: key, txnid, amount, productinfo, firstname, email, phone, surl, furl, hash

Required parameter that is not in the transaction request: key, txnid, amount, productinfo, surl, hash, firstname, email, phone.

Here it shows that the furl parameter is missing, but I provided for this. My code is as follows:

app.get('/payu',function(req,res){

var request = require('request'),
    crypto=require('crypto'),
    str='taO2Gy|idr001|50|test|anonymous|anonymous@gmail.com|||||||||||CMpSRcXk';

var hash = crypto.createHash('sha512');
hash.update(str);
var value = hash.digest('hex');

console.log(value);

var params={
   'key':'taO2Gy',
   'txnid':'idr001',
   'amount':'50',
   'productinfo':'test',
   'firstname':'anonymous',
   'email':'anonymous@gmail.com',
   'phone':'9999999999',
   'surl':'http://localhost:8080/',
   'furl': 'http://localhost:8080/',
   'curl': 'http://localhost:8080/',
   'hash':value,
  'service_provider':'payu_paisa'
};


request({
  url:"https://test.payu.in/_payment",
  method:"POST",
  json:true,
  body:params
}, function(err,response,body){
  if(err)
    console.log('Error : ' + err);
  res.send(body);
});

});
+4
source share
2 answers

Submit your parameter as follows

var params = {
        url: 'https://test.payu.in/_payment',

        form: {
          key: key,
          txnid: txnid,
          amount: amount,
          productinfo: productinfo,
          firstname: firstname,
          email: email,
          phone: phone,
          surl: surl,
          furl: furl,
          hash: hash,
          service_provider: service_provider,

        }
      };
+1
source

.

. '': CMpSRcXk

0

Source: https://habr.com/ru/post/1609466/


All Articles