java 接受托管授权网络集成问题,付款后没有重定向到我的本地主机

gz5pxeao  于 2024-01-05  发布在  Java
关注(0)|答案(3)|浏览(195)

我正在为我的网站集成Authorize net。我能够生成令牌。获得令牌后,我在我的沙箱帐户上发布请求。我能够进行测试付款。但付款后,它不会返回我的网站。继续按钮没有任何作用。
这是我的设置和表单请求。如果我缺少什么,请告诉我。这是我获取令牌的代码。

  1. public static GetHostedPaymentPageResponse run(String apiLoginId, String transactionKey, Double amount) {
  2. ApiOperationBase.setEnvironment(Environment.SANDBOX);
  3. MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
  4. merchantAuthenticationType.setName(apiLoginId);
  5. merchantAuthenticationType.setTransactionKey(transactionKey);
  6. ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
  7. // Create the payment transaction request
  8. TransactionRequestType txnRequest = new TransactionRequestType();
  9. txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
  10. txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
  11. SettingType setting2 = new SettingType();
  12. setting2.setSettingName("hostedPaymentOrderOptions");
  13. setting2.setSettingValue("{\"show\": true}");
  14. setting2.setSettingValue("{\"merchantName\": \"Questions Inc.\"}");
  15. SettingType setting1 = new SettingType();
  16. setting1.setSettingName("hostedPaymentButtonOptions");
  17. setting1.setSettingValue("{\"text\": \"Pay Now\"}");
  18. SettingType setting3 = new SettingType();
  19. setting3.setSettingName("hostedPaymentReturnOptions");
  20. setting3.setSettingValue("{\"showReceipt\": true}");
  21. setting3.setSettingValue("{\"url\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  22. setting3.setSettingValue("{\"urlText\": \"Return\"}");
  23. setting3.setSettingValue("{\"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  24. setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");
  25. ArrayOfSetting alist = new ArrayOfSetting();
  26. alist.getSetting().add(setting1);
  27. alist.getSetting().add(setting2);
  28. alist.getSetting().add(setting3);
  29. GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
  30. apiRequest.setTransactionRequest(txnRequest);
  31. apiRequest.setHostedPaymentSettings(alist);
  32. GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
  33. controller.execute();
  34. GetHostedPaymentPageResponse response = new GetHostedPaymentPageResponse();

字符串
这是我的申请表

  1. <form method="POST" action="https://test.authorize.net/payment/payment" id="DemoCheckoutForm" name="DemoCheckoutForm">
  2. <input type="hidden" name="token" value="<%=token%>" >
  3. <input type="submit" name="submit_b" value="Buy now" >

mkshixfv

mkshixfv1#

德文德·库马尔
请将您的设置3设置如下,

  1. SettingType setting3 = new SettingType();
  2. setting3.setSettingName("hostedPaymentReturnOptions");
  3. setting3.setSettingValue("{\"showReceipt\": false}");
  4. setting3.setSettingValue("{\"url\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  5. setting3.setSettingValue("{\"urlText\": \"Return\"}");
  6. setting3.setSettingValue("{\"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  7. setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");

字符串
当你想在AdverdPaymentReturnOptions设置中重定向给定的URL时,showReceipt应该为false。

au9on6nz

au9on6nz2#

我无意中发现了这个页面,正在寻找解决方法。看起来授权不允许在取消/继续URL中使用localhost127.0.0.1。我仍在试图找出解决方法。

h4cxqtbf

h4cxqtbf3#

这就是我犯的错误。

  1. SettingType setting3 = new SettingType();
  2. setting3.setSettingName("hostedPaymentReturnOptions");
  3. setting3.setSettingValue("{\"showReceipt\": true}");
  4. setting3.setSettingValue("{\"url\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  5. setting3.setSettingValue("{\"urlText\": \"Return\"}");
  6. setting3.setSettingValue("{\"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
  7. setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");

字符串
正如你所看到的,它只接受最后一个值。

  1. setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");


相反,它应该像下面这样。将所有参数 Package 在json中,然后设置值。

  1. setting3.setSettingValue("{\"showReceipt\": true,
  2. \"url\": \"http://localhost:8070/wap-adaptor/response.jsp\",
  3. \"urlText\": \"Return\",
  4. \"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\",
  5. \"cancelUrlText\": \"Cancel\"}");


真是个愚蠢的错误

展开查看全部

相关问题