4

I am trying to integrate payUMoney in node.js, but I am getting an error as

Mandatory parameters which must be sent in the transaction are: key, txnid, amount, productinfo, firstname, email, phone, surl, furl, hash

Mandatory parameter missing from your transaction request are: key, txnid, amount, productinfo, surl, hash, firstname, email, phone.

Here it is showing that the parameter furl is missing but I provided that. 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);
});

});
Nitish Kumar
  • 101
  • 6

2 Answers2

1

Send 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,

        }
      };
Atul Agrawal
  • 1,474
  • 5
  • 22
  • 41
0

You did not provide salt in body params . You must have to provide it for example:

 'salt':CMpSRcXk

It will work.

4b0
  • 21,981
  • 30
  • 95
  • 142
Pooja-G
  • 518
  • 4
  • 20