【问题标题】:E00007 : User authentication failed due to invalid authentication values. in auth.netE00007 : 由于验证值无效,用户验证失败。在 auth.net
【发布时间】:2017-06-02 09:45:14
【问题描述】:

我是 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.

【问题讨论】:

  • 您是否确认您使用的凭据用于沙盒并且来自sandbox.authorize.net?生产和沙盒凭据是分开的,不能用于其他系统。
  • @rhldr - 这很明显,我只使用沙盒,我还没有 Prod 凭据。使用此 API 密钥和事务密钥成功调用所有其他 API。

标签: java authorize.net


【解决方案1】:

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

merchantAuthenticationType.setTransactionKey("transactionKey"); 

改成

merchantAuthenticationType.setTransactionKey(transactionKey);

【讨论】:

    【解决方案2】:

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

    要测试您的 Authorize.net 身份验证凭据,请转到 [Authorize.net 的 API 文档站点] 并选择 API Endpoints and Authentication,然后选择 test your authentication credentials 框.1

    【讨论】:

    • 这个问题已经有一个可以接受的答案,可以解决他们的问题。您添加这个通用答案有什么原因吗?
    猜你喜欢
    • 2021-02-28
    • 2012-07-23
    • 2015-02-06
    • 2016-02-18
    • 2016-12-14
    • 2018-01-31
    • 2018-05-01
    • 1970-01-01
    • 2016-01-23
    相关资源
    最近更新 更多