gpt4 book ai didi

java - auth.net 中的 E00007 : User authentication failed due to invalid authentication values.

转载 作者:行者123 更新时间:2023-12-02 13:00:16 25 4
gpt4 key购买 nike

我是 Authorized.net API 的新手,在authorized.net 中遇到以下E00007,用户身份验证因无效身份验证值而失败。。我正在使用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);

关于java - auth.net 中的 E00007 : User authentication failed due to invalid authentication values.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44325790/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com