首页 文章

在nodejs中集成payUMoney时出错

提问于
浏览
4

我想在node.js中集成payUMoney,但是我收到了一个错误

必须在事务中发送的必需参数是:key,txnid,amount,productinfo,firstname,email,phone,surl,furl,hash

您的交易请求中缺少必需参数:key,txnid,amount,productinfo,surl,hash,firstname,email,phone .

这里显示参数furl缺失,但我提供了 . 我的代码如下:

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);
});

});

2 回答

  • 1

    发送您的参数如下

    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,
    
            }
          };
    
  • 0

    你没有在身体参考中提供盐 . 你必须提供它,例如:

    'salt':CMpSRcXk
    

    它会工作 .

相关问题