MeteorJs:支付整合(PayUMoney)校验和失败

时间:2017-04-27 07:24:55

标签: meteor payment-gateway payumoney

我正在研究MeteorJS(nodeJS)。试图将payumoney集成到localhost上。我有实时凭证并将我的HTTP呼叫转发到: POST网址:https://secure.payu.in/_payment。 在控制台上我得到状态代码为200.但是没有指向payu.com但是在控制台上我能够看到"校验和失败"错误。我试着打包:  1.jparker:加密SHA256  2.johnschult:加密SHA512

这是我的代码:

var string = key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|||||||||||'+salt;
var SHA    = CryptoJS.SHA256(string);

也尝试过这样:

var string = key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+'|'+salt;
    var SHA    = CryptoJS.SHA256(string);

    console.log("SHA :" + SHA);
    this.unblock();
    var payUMoneyInput = {
               "key"              :  key,
               "txnid"            :  txnid,
               "amount"           :  amount,
               "productinfo"      :  productinfo,
               "firstname"        :  firstname,
               "email"            :  email,
               "phone"            :  phone,
               "surl"            "http://localhost:3000/onlinePaymentSuccess",
               "furl"             :  "http://localhost:3000/onlinePaymentSuccess",
               "hash"             :  SHA,
               "service_provider" : "payu_paisa",
          };

    try {
      if (Meteor.isServer) {
        var result = HTTP.call("POST", "https://secure.payu.in/_payment",
                               {params: payUMoneyInput});

        console.log(result);
          return result;
         }else{
           return false;
         }
      }
    } catch (err) {
      console.log('range error');
      console.log(err)
      // Got a network error, time-out or HTTP error in the 400 or 500 range.
      return false;
    }

我的控制台如下所示:

0427-12:52:44.069(5.5)? SHA :f071c643368745b38f8b41851d6500743190aa79426e931a28ccfd65135d94ed
I20170427-12:52:44.237(5.5)? { statusCode: 200,
I20170427-12:52:44.237(5.5)?   content: '<!DOCTYPE html>\n<!--[if lt IE 7 ]> <html lang="en" class="no-js oldie ie6"> <![endif]-->\n<!--[if IE 7 ]>    <html lang="en" class="no-js oldie ie7"> <![endif]-->\n<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->\n<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->\n\n\n<!-- Custom Modernizr build (should always be on the top) -->\n<script src="js/modernizr-2.0.6.min.js"></script>\n    <script language="javascript">\n      document.title = "Transaction Error";\n    </script>\n\n<style>\n    body {font-family: \'Arial\'}\n    .container {width: 960px; margin: 0 auto; padding: 15px 0;}\n\n    #header {border-bottom: 1px solid #ccc;}\n    #content {padding: 100px;}\n    #content h1 {font-size: 70px; color: #358DCB; margin-bottom: 0; margin-top: 0; text-align: center}\n    #content h2 {font-size: 16px; margin-top: 0; text-align: center}\n    #content p {font-size: 14px; margin-top: 30px; line-height: 24px; padding: 0 150px;}\n\n    #footer {border-top: 1px solid #ddd; font-size: 12px;}\n    #footer p {margin-top: 0;}\n\n    #footer a {text-decoration: underline}\n</style>\n\n<div id="header">\n    <div class="container">\n        <img src="https://static.payu.in/images/payu_logo.png">\n    </div>\n</div>\n<div id="content" >\n    <div class="container">\n        <h1>SORRY!</h1>\n        <h2>We were unable to process your payment</h2>\n            <p style=\'text-align: center;font-size:13px;\'><br>Checksum Failed</p>    </div>\n\n    </div>\n\n<div id="footer">\n    <div class="container">\n        <!--<p style="float:left">&copy; 2015 PayUBiz. All rights reserved.</p>\n        <p style="float:right"><a target="_blank" href=https://www.payubiz.in/privacyPolicy >Privacy Policy</a></p>\n        <p style="clear:both"></p>-->\n        <p style="text-align: center">&copy; 2015 PayUBiz. All rights reserved.</p>\n    </div>\n</div>\n\n<script src="js/libs/jquery-custom.min.js"></script>\n<!-- <script src="./_js/plugins.js"></script> -->\n<script src="js/script.js?version=v2.0.10"></script>\n\n',
I20170427-12:52:44.237(5.5)?   headers: 
I20170427-12:52:44.238(5.5)?    { date: 'Thu, 27 Apr 2017 07:22:44 GMT',
I20170427-12:52:44.238(5.5)?      'content-type': 'text/html',
I20170427-12:52:44.238(5.5)?      'transfer-encoding': 'chunked',
I20170427-12:52:44.238(5.5)?      connection: 'close',
I20170427-12:52:44.239(5.5)?      vary: 'Accept-Encoding, Accept-Encoding',
I20170427-12:52:44.239(5.5)?      'set-cookie': [ 'PHPSESSID=bpgqhvng7blpk1fltvrohle0j0; path=/; secure' ],
I20170427-12:52:44.239(5.5)?      p3p: 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"',
I20170427-12:52:44.239(5.5)?      expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
I20170427-12:52:44.240(5.5)?      'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0',
I20170427-12:52:44.241(5.5)?      pragma: 'no-cache',
I20170427-12:52:44.241(5.5)?      server: 'Payubiz',
I20170427-12:52:44.242(5.5)?      'x-xss-protection': '1; mode=block' },
I20170427-12:52:44.244(5.5)?   data: null }

无法跟踪问题。提前谢谢!

1 个答案:

答案 0 :(得分:0)

根据payu integration document和那里的公式,你的哈希应该是:

var sha=sha512(key +'|' +txnid+ '|' +amount+'|'+productinfo+'|'+firstname+'|'+email+'|||||||||||' + salt+'|');
var hash=CryptoJS.enc.Hex.stringify(sha);