Authorize.net 沙盒接受页面测试 - 总是被拒绝?

Authorize.net Sandbox Accept page testing- always declined?

我正在尝试使用我的沙箱测试接受托管付款页面(重定向方法)。为此,我使用 Java 示例代码应用程序中的 GetAnAcceptPaymentPage 生成支付令牌字符串,为我的沙箱指定 autoLoginId 和 transactionKey,并将金额设置为 1.00 美元。然后我将返回的令牌字符串发布到 https://test.authorize.net/payment/payment with a “token” form element containing that string. This much appears to be working, and I do get a payment page showing the .00 amount. However, no matter what values I enter onto that payment page, pressing the “Pay” button just shows “The transaction has been declined.” in red text at the bottom of the form. I’ve confirmed that my sandbox is set to “Live” mode, and have looked at the following link to use what I believe should be valid values for testing: https://developer.authorize.net/hello_world/testing_guide/。我希望有人能告诉我为什么除了“交易已被拒绝”之外我得不到任何结果。

public String getTokenValue() {
    ApiOperationBase.setEnvironment(Environment.SANDBOX);
    MerchantAuthenticationType merchantAuthenticationType = new MerchantAuthenticationType();
    merchantAuthenticationType.setName("xxxxx");
    merchantAuthenticationType.setTransactionKey("xxxxxx");
    ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

    // Create the payment transaction request
    TransactionRequestType txnRequest = new TransactionRequestType();
    txnRequest.setTransactionType(TransactionTypeEnum.AUTH_CAPTURE_TRANSACTION.value());
    txnRequest.setAmount(new BigDecimal(1.00).setScale(2, RoundingMode.CEILING));
    OrderExType order = new OrderExType();
    order.setInvoiceNumber("2");
    txnRequest.setOrder(order);
    CustomerProfilePaymentType cpp = new CustomerProfilePaymentType();
    cpp.setCustomerProfileId("xxxx");
    cpp.setCreateProfile(true);
    txnRequest.setProfile(cpp);

    SettingType setting1 = new SettingType();
    setting1.setSettingName("hostedPaymentButtonOptions");
    setting1.setSettingValue("{\"text\": \"Proceed\"}");

    SettingType setting2 = new SettingType();
    setting2.setSettingName("hostedPaymentOrderOptions");
    setting2.setSettingValue("{\"show\": false}");

    SettingType setting3 = new SettingType();
    setting3.setSettingName("hostedPaymentPaymentOptions");
    setting3.setSettingValue("{\"cardCodeRequired\": true}");

    SettingType setting4 = new SettingType();
    setting4.setSettingName("hostedPaymentIFrameCommunicatorUrl");
    setting4.setSettingValue("{\"url\": \"http://example.com/abc\"}");

    ArrayOfSetting alist = new ArrayOfSetting();
    alist.getSetting().add(setting1);
    alist.getSetting().add(setting2);
    alist.getSetting().add(setting3);
    alist.getSetting().add(setting4);

    GetHostedPaymentPageRequest apiRequest = new GetHostedPaymentPageRequest();
    apiRequest.setTransactionRequest(txnRequest);
    apiRequest.setHostedPaymentSettings(alist);

    GetHostedPaymentPageController controller = new GetHostedPaymentPageController(apiRequest);
    controller.execute();
    GetHostedPaymentPageResponse response = new GetHostedPaymentPageResponse();
    response = controller.getApiResponse();

    if (response != null) {

        if (response.getMessages().getResultCode() == MessageTypeEnum.OK) {

            System.out.println(response.getToken());
        } else {
            System.out.println("Failed to get hosted payment page:  " + response.getMessages().getResultCode());
        }
    }
    return response.getToken();
}

>>> order.setInvoiceNumber("2");

将发票编号设置为不同于 2 的值,此值在沙盒中用于触发拒绝以进行测试。