javaauthorize.net

E00007 : User authentication failed due to invalid authentication values. in auth.net


I am new to the Authorized.net API and facing the below E00007, User authentication failed due to invalid authentication values. in authorized.net. I am using the authorize.net version to call the GetTransactionDetails API.

Any idea on what is the issue ? Any help ?

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

and I am using the below code

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());
                }
            }
        }
    }
}

output:

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.

Solution

  • Can you try removing the quotes from setTransactionKey

    merchantAuthenticationType.setTransactionKey("transactionKey"); 
    

    change to

    merchantAuthenticationType.setTransactionKey(transactionKey);