我正在为我的网站整合Authorize net。我能够生成令牌。获得令牌后,我在沙盒帐户上发布请求。我能够支付测试费用。但付款后,它不会让我回到我的网站上。 “继续”按钮不执行任何操作。
这是我的设置和表单请求。如果我有任何遗漏,请告诉我。 这是我获取令牌的代码。
public static GetHostedPaymentPageResponse run(String apiLoginId, String transactionKey, Double amount) {
ApiOperationBase.setEnvironment(Environment.SANDBOX);
MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType() ;
merchantAuthenticationType.setName(apiLoginId);
merchantAuthenticationType.setTransactionKey(transactionKey);
ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);
// Create the payment transaction request
TransactionRequestType txnRequest = new TransactionRequestType();
txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
txnRequest.setAmount(new BigDecimal(amount).setScale(2, RoundingMode.CEILING));
SettingType setting2 = new SettingType();
setting2.setSettingName("hostedPaymentOrderOptions");
setting2.setSettingValue("{\"show\": true}");
setting2.setSettingValue("{\"merchantName\": \"Questions Inc.\"}");
SettingType setting1 = new SettingType();
setting1.setSettingName("hostedPaymentButtonOptions");
setting1.setSettingValue("{\"text\": \"Pay Now\"}");
SettingType setting3 = new SettingType();
setting3.setSettingName("hostedPaymentReturnOptions");
setting3.setSettingValue("{\"showReceipt\": true}");
setting3.setSettingValue("{\"url\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
setting3.setSettingValue("{\"urlText\": \"Return\"}");
setting3.setSettingValue("{\"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");
ArrayOfSetting alist = new ArrayOfSetting();
alist.getSetting().add(setting1);
alist.getSetting().add(setting2);
alist.getSetting().add(setting3);
GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
apiRequest.setTransactionRequest(txnRequest);
apiRequest.setHostedPaymentSettings(alist);
GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
controller.execute();
GetHostedPaymentPageResponse response = new GetHostedPaymentPageResponse();
这是我的申请表
<form method="POST" action="https://test.authorize.net/payment/payment" id="DemoCheckoutForm" name="DemoCheckoutForm">
<input type="hidden" name="token" value="<%=token%>" >
<input type="submit" name="submit_b" value="Buy now" >
答案 0 :(得分:0)
Devender Kumar
请将您的设置3设置如下,
SettingType setting3 = new SettingType();
setting3.setSettingName("hostedPaymentReturnOptions");
setting3.setSettingValue("{\"showReceipt\": false}");
setting3.setSettingValue("{\"url\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
setting3.setSettingValue("{\"urlText\": \"Return\"}");
setting3.setSettingValue("{\"cancelUrl\": \"http://localhost:8070/wap-adaptor/response.jsp\"}");
setting3.setSettingValue("{\"cancelUrlText\": \"Cancel\"}");
当您想在hostedPaymentReturnOptions设置中重定向给定网址时,showReceipt应为false。
答案 1 :(得分:0)
我偶然发现了这个页面,正在寻找解决方法。看起来授权不允许在取消/继续 URL 中使用 localhost
或 127.0.0.1
。我还在想办法解决。