node.js - PayuMoney India 与 Node js 集成

标签 node.js payment-gateway payumoney

我正在尝试集成一个nodejs应用程序以与PayUMoney集成。我按照 php 的说明和示例代码进行操作并在 node.js 中实现,但我收到校验和错误

Error. We are sorry we are unable to process your payment.

Checksum Failed. Please contact your merchant.

这是代码。前端

<form method="post" id="payu-payment-form" action="https://test.payu.in/_payment">
    <input type="hidden" name="hash" value="hash"/>
    <input type="hidden" name="key" value="marchentKey"/>
    <input type="hidden" name="txnid" value="asc123"/>
    <input type="hidden" name="amount" value="1000" />
    <input type="hidden" name="productinfo" value="Product 1"/>
    <input type="hidden" name="firstname" value="Amit" />
    <input type="hidden" name="email" value="abc@gmail.com" />
    <input type="hidden" name="phone" value="123423233" />
    <input type="hidden" name="surl" value="http://localhost/success"/>
    <input type="hidden" name="furl" value="http://localhost/fail"/>
    <input type="hidden" name="service_provider" value="payu_paisa" />
    <button class="" type="submit" formtarget="_blank" >Buy</button>
</form>

Node.js

var txnid='asc123';
var amount=1000;
var produnctinfo='Product 1';
var firstname='Amit';
var email='abc@gmail.com';
var phone='123423233';
var surl='http://localhost/success';
var furl='http://localhost/fail';
var service_provider='payu_paisa';
var string = marchentKey +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|'+phone+'|'+ surl +'|'+furl+'|'+service_provider+'|||||||'+salt;
var hash=sha512(string);

最佳答案

PHP 集成套件中的测试 key 和盐无法正常工作。因此,使用我自己的测试 key 和盐并计算正确的哈希值,其工作正常。

之前我使用phone、surl、furl 和service_provider 计算哈希值。但应该是这样的

var string = marchentKey +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|||||||||||'+salt;
var hash=sha512(string);

如果您发布的变量在其文档中未提及,即用户定义的变量,那么您应该将这些变量包含为 udf1、udf2..

var string = marchentKey +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|'+udf1+'|'+udf2+'|||||||||'+salt;
var hash=sha512(string);

关于node.js - PayuMoney India 与 Node js 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31913775/

相关文章:

paypal - 我使用哪个 URL 来 "COMPLETE"SagePay 模拟器上的 PayPal 交易?

javascript - Nodejs MySQL连接查询返回值给函数调用

node.js - 使用特定选项或环境变量在 AWS lambda 中启动 NodeJS 运行时

.net - 如何将 MoneyBookers 与 ASP.NET 应用程序集成?

ios - Braintree:在沙盒模式下创建或更新具有 CVV 验证的客户时出现授权错误

ruby-on-rails - 通过 payumoney 付款

android - Payu支付错误 "Some error occurred, Try again!"

javascript - 重命名与 Sequelize 的关联

node.js - 如何授权访问 Google Cloud Function 中的 Directory API

android - 如何只为一个模块启用proguard