Realex支付,反应不能进行处理的.Net(Realex payment, response ca

2019-10-30 08:38发布

我试图执行一个HPP充分重定向realex付款,我有2个控制器的一个该请求发送到所述realex付款服务器和所述第二到的响应被发送回。 我得到这样的JSON响应

{"RESULT":"00","AUTHCODE":"12345","MESSAGE":"[ test system ] AUTHORISED","PASREF":"15441812060166886","AVSPOSTCODERESULT":"M","AVSADDRESSRESULT":"M","CVNRESULT":"M","ACCOUNT":"internet","MERCHANT_ID":"MyID","ORDER_ID":"UYCRWpJtlE-B1n62SE7EKg","TIMESTAMP":"20181207111253","AMOUNT":"199","MERCHANT_RESPONSE_URL":"URL to my webcontroller","pas_uuid":"b3cfa79e-2b60-4f2a-9dad-cfa897f17189","SHA1HASH":"c193e099da587b28810775f388d15c2f88fd637c","BATCHID":"601099"}

有问题的IM是这样的JSON显示在页面下面的网址。 https://pay.sandbox.realexpayments.com/card.html?guid=b3cfa79e-2b60-4f2a-9dad-cfa897f17189但我想提取此JSON订单ID和交易ID和金额,并在某种显示它形式在了公司页面,告知有支付作为了全成或谢绝基于结果的用户。

客户端代码调用它:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Title</title>
<!-- reference to your css file below. You can also use a separate css from your desktop more at https://developer.realexpayments.com/#!/hpp/customisation-->
<link rel="stylesheet" type="text/css" href="resources/css/styles.css">
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="rxp-js-master/lib/rxp-hpp.js"></script>
<script>

  $(document).ready(function() {

    $.getJSON("URL to my first controller", function(jsonFromRequestEndpoint) { 
    ///alert(jsonFromRequestEndpoint);
      RealexHpp.setHppUrl("https://pay.sandbox.realexpayments.com/pay");
      // When using full page redirect your Response URL must be an absolute link

      RealexHpp.redirect.init("payButtonId", "URL to my second controller", jsonFromRequestEndpoint);


      const URL = "https://development.eurowatchcentral.com"
            const data = jsonFromRequestEndpoint;

            $.post(URL, data, function(data, status){

            console.log ('${data} and status is ${status}')

            });
      });


  });




</script>
</head>
<body>
<!-- The tag <hpp:body /> below indicates where the payment form will be placed - for all guidelines on templates please visit https://developer.realexpayments.com/#!/hpp/customisation-->
        <div>

<form >

<button type="button" value="payButtonId" id ="payButtonId">Click Me!</button>
        </div>

        <p id="demo"></p>
    </form> 
</body>
</html>

我试图寻找在API中的任何相关步骤,但我在努力寻找任何。

Answer 1:

当使用完整页面重定向(而不是一个iFrame)时,将HPP的响应POST发送到第二控制器。 这被作为一个标准的HTTP POST,它不被作为一个JSON字符串。

此刻,同样,HPP将呈现由所述第二控制器向所述浏览器输出的任何HTML内容。 所以,我们通常会建议在这一点的是,经过检查响应是有效的(检查哈希和时间戳等),你可以使用JavaScript重定向到浏览器重定向到您想要的网址。 例如,成功或失败的页面。



文章来源: Realex payment, response cant be Handled .Net