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

E00007 : User authentication failed due to invalid authentication values. in auth.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.

你能试试从 setTransactionKey 中删除引号吗

merchantAuthenticationType.setTransactionKey("transactionKey"); 

改为

merchantAuthenticationType.setTransactionKey(transactionKey);

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

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