E00007:由于身份验证值无效,用户身份验证失败。在auth.net

时间:2017-06-02 09:45:14

标签: java authorize.net

我是Authorized.net API的新手,面向authorized.net下面的E00007, User authentication failed due to invalid authentication values.。我使用authorize.net版本来调用GetTransactionDetails API。

关于什么是问题的任何想法?有什么帮助吗?

<dependency>
            <groupId>net.authorize</groupId>
            <artifactId>anet-java-sdk</artifactId>
            <version>1.8.6</version>
        </dependency>

我正在使用以下代码

public class GetTransactionDetails {

    public static final String apiLoginId= "6LaBc8HJ6Q";
    public static final String transactionKey= "XXXXXXXX";

    public static void main(String[] args) {
        ApiOperationBase.setEnvironment(Environment.SANDBOX);

        MerchantAuthenticationType merchantAuthenticationType  = new MerchantAuthenticationType() ;
        merchantAuthenticationType.setName(apiLoginId); 
        merchantAuthenticationType.setTransactionKey("transactionKey");

        ApiOperationBase.setMerchantAuthentication(merchantAuthenticationType);

        //need valid transacaction Id to run  
        String transId = "60024624183";

        GetTransactionDetailsRequest getRequest = new GetTransactionDetailsRequest();
        getRequest.setMerchantAuthentication(merchantAuthenticationType);
        getRequest.setTransId(transId);

        GetTransactionDetailsController controller = new GetTransactionDetailsController(getRequest);
        controller.execute();
        GetTransactionDetailsResponse getResponse = controller.getApiResponse();

        TransactionDetailsType transactionDetailsType = getResponse.getTransaction();

        if (getResponse!=null) {
            if (getResponse.getMessages().getResultCode() == MessageTypeEnum.OK) {
                System.out.println(getResponse.getMessages().getMessage().get(0).getCode());
                System.out.println(getResponse.getMessages().getMessage().get(0).getText());

                System.out.println("---------------------------------------");
                System.out.println("Auth Amount                 : "+transactionDetailsType.getAuthAmount());
                System.out.println("Auth Code                   : "+transactionDetailsType.getAuthCode());
                System.out.println("Response Reason Description : "+transactionDetailsType.getResponseReasonDescription());
                System.out.println("Transaction Status          : "+transactionDetailsType.getTransactionStatus());
                System.out.println("Submit Date                 : "+transactionDetailsType.getSubmitTimeLocal());
            }else{
                System.out.println("Failed to get transaction details:  " + getResponse.getMessages().getResultCode());
                List<Message> messages = getResponse.getMessages().getMessage();
                for (Message message : messages) {
                    System.out.println("Code   : "+message.getCode());
                    System.out.println("Text   : "+message.getText());
                }
            }
        }
    }
}

输出:

06/02/17 00:35:48,733:  INFO [pool-1-thread-1] (net.authorize.util.LogHelper:24) - Use Proxy: 'false'
Failed to get transaction details:  ERROR
Code   : E00007
Text   : User authentication failed due to invalid authentication values.

2 个答案:

答案 0 :(得分:0)

您可以尝试从setTransactionKey中删除引号

merchantAuthenticationType.setTransactionKey("transactionKey"); 

更改为

merchantAuthenticationType.setTransactionKey(transactionKey);

答案 1 :(得分:0)

导致此错误的原因有多种,可能包括:

要测试您的 Authorize.net 身份验证凭据,请转到 [Authorize.net 的 API 文档站点] 并选择API 端点和身份验证,然后选择测试您的身份验证凭据框.1