我试图调用TransactionSearch。但我得到了异常缺少凭据异常 这是我的代码
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);
&#13;
请帮助我 谢谢
答案 0 :(得分:1)
PayPal核心SDK 中的CredentialManager
( PayPal商家SDK 使用并且是此异常的来源)需要经典的帐户详细信息配置中的应用程序前面有account#.
令牌。因此,对于单个帐户,如您设置代码的方式,配置详细信息应指定如下:
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#.
令牌来添加配置中的后续帐户。
此外,上面的代码更正了以下两个配置属性名称:
appid
应为account#.applicationId
ipn
应为IPNEndpoint
有关配置密钥的更多信息,请访问here。