【问题标题】:PayuMoney India integration with Node jsPayuMoney India 与 Node js 的集成
【发布时间】:2015-11-02 00:37:40
【问题描述】:

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

错误。很抱歉,我们无法处理您的付款。

校验和失败。请联系您的商家。

这里是代码。前端

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

【问题讨论】:

  • "marchentKey" - 这里有一个错字。
  • 我故意把“marchentKey”放在这里..我正在使用我的原始测试密钥、盐和html形式生成的哈希
  • 我什至尝试使用我为测试目的找到的测试密钥和盐。键“JBZaLc”和盐“GQs7yium”
  • 嗨@optimus,你用payUmoney完成了付款吗。
  • 我在成功和失败页面上遇到了一些问题,你可以分享一个链接吗?谢谢。

标签: node.js payment-gateway payumoney


【解决方案1】:

我认为问题在于您使用自定义名称发布用户定义的变量。 使用 udf1 而不是使用 service_provider。

<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="surl" value="http://localhost/success"/>
    <input type="hidden" name="furl" value="http://localhost/fail"/>
    <input type="hidden" name="phone" value="123423233" />
    <input type="hidden" name="udf1" value="payu_paisa" />
    <button class="" type="submit" formtarget="_blank" >Buy</button>
</form>

哈希计算

hash=sha512(key|txnid|amount|productinfo|firstname|email|udf1||||||||||SALT);

【讨论】:

  • 通过使用udfs,它给出“对不起,发生了一些问题”。错误
  • 根据我的经验,我们不能为用户定义的变量使用自定义名称
  • 在 PayU 文档电话中,surl、furl 和 service_provider 是必填字段,但在他们的 PHP 示例中,他们没有使用这些字段来计算哈希。 udf1、udf2..字段是用户定义的字段,它们不是用来替换phone、surl、furl和service_provider的。
  • phone、surl 和 furl 是必填字段。但 service_provider 不是。如果您想在帖子参数中提及它,请使用用户定义的变量,
  • service_provider 也是必填项。
【解决方案2】:

PHP 集成工具包中的测试密钥和盐不起作用。所以使用我自己的测试密钥和盐并计算正确的哈希它工作正常。

以前我用 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);

【讨论】:

    【解决方案3】:

    var service_provider='';

    将服务提供商字段留空。 应该可以的。

    【讨论】:

      猜你喜欢
      • 2016-07-20
      • 2021-11-25
      • 1970-01-01
      • 1970-01-01
      • 2017-06-14
      • 1970-01-01
      • 2020-03-11
      • 2016-06-08
      • 2018-04-22
      相关资源
      最近更新 更多