gpt4 book ai didi

c# - PayPal 缺少凭据 - TransactionSearch(经典 API)

转载 作者:太空宇宙 更新时间:2023-11-03 16:28:38 25 4
gpt4 key购买 nike

我正在尝试调用 TransactionSearch。但是我得到了异常 Missing credentials Exception enter image description here这是我的代码

TransactionSearchResponseType responseTransactionSearchResponseType = new TransactionSearchResponseType();
TransactionSearchReq requestTransactionSearch = new TransactionSearchReq();
TransactionSearchRequestType transactionSearchRequest = new TransactionSearchRequestType("2012-12-25T00:00:00+0530");
requestTransactionSearch.TransactionSearchRequest = transactionSearchRequest;

Dictionary<string, string> paypalConfig = new Dictionary<string, string>();
paypalConfig.Add("apiUsername", "userName");
paypalConfig.Add("apiPassword", "passowrd");
paypalConfig.Add("apiSignature", "Signature");
paypalConfig.Add("appid", "appID");
paypalConfig.Add("ipn","https://www.paypal.com/cgi-bin/webscr");
paypalConfig.Add("url", "https://www.paypal.com/webscr&cmd=_express-checkout&token=");
paypalConfig.Add("endpoint", "https://api-3t.paypal.com/2.0/");
paypalConfig.Add("mode", "live");

PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(paypalConfig);
responseTransactionSearchResponseType = service.TransactionSearch(requestTransactionSearch);
这是什么原因?这不是我的凭证的问题。那我的根本原因是什么?

请帮帮我谢谢

最佳答案

CredentialManagerPayPal Core SDK(PayPal Merchant SDK 使用并且是此异常的来源)要求配置中经典应用的帐户详细信息前面有account#. token 。因此,对于单个帐户,例如您如何设置代码,配置详细信息应指定如下:

Dictionary<string, string> paypalConfig = new Dictionary<string, string>();
paypalConfig.Add("account1.apiUsername", "userName");
paypalConfig.Add("account1.apiPassword", "passowrd");
paypalConfig.Add("account1.apiSignature", "Signature");
paypalConfig.Add("account1.applicationId", "appID");
paypalConfig.Add("IPNEndpoint","https://www.paypal.com/cgi-bin/webscr");
paypalConfig.Add("url", "https://www.paypal.com/webscr&cmd=_express-checkout&token=");
paypalConfig.Add("endpoint", "https://api-3t.paypal.com/2.0/");
paypalConfig.Add("mode", "live");

可以通过递增 account#. token 来添加配置中的后续帐户。

此外,上面的代码更正了以下两个配置属性名称:

  • appid 应该是 account#.applicationId
  • ipn 应该是 IPNEndpoint

可以找到有关配置键的更多信息 here .

关于c# - PayPal 缺少凭据 - TransactionSearch(经典 API),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28054671/

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