-1
我正在嘗試創建一個程序,用於使用PayPal自適應付款API向用戶付款。我試圖實現支付用戶的隱式付款方式(所以我不必批准每一個)。我目前動態傳遞的PayPal憑證中使用詞典的配置,例如:缺少錯誤 - 貝寶自適應付款API錯誤
accountConfig = new Dictionary<string, string>();
accountConfig.Add("X-PAYPAL-SECURITY-USERID", "I HAVE PUT MY USERID HERE");
accountConfig.Add("X-PAYPAL-SECURITY-SIGNATURE", "MY SIGNATURE HERE"
accountConfig.Add("X-PAYPAL-SECURITY-PASSWORD", "MY PASSWORD HERE");
accountConfig.Add("X-PAYPAL-APPLICATIONID", "APP-80W284485P519543T");
accountConfig.Add("X-PAYPAL-REQUEST-DATA-FORMAT", "NV");
accountConfig.Add("X-PAYPAL-RESPONSE-DATA-FORMAT", "NV");
然後,我在配置付款如下:
AdaptivePaymentsService aps = new AdaptivePaymentsService(accountConfig);
Receiver receiver = new Receiver { email = "RECEIVER EMAIL", amount = payment.CommissionAmount };
List<Receiver> l = new List<Receiver> { receiver };
RequestEnvelope re = new RequestEnvelope { errorLanguage = "en_US" };
PayRequest payRequest = new PayRequest(
re,
"SERVICE",
"http://cancelUrl",
"USD",
new ReceiverList(l),
"http://returnUrl");
payRequest.senderEmail = "I HAVE PUT MY USERID HERE";
aps.Pay(payRequest);
根據該文件,在隱含付款部分下,您應該能夠使用API調用者的帳戶電子郵件作爲發件人電子郵件,這被認爲是隱式付款。但是,我應該在哪裏做這件事?如果我不喜歡它上面,將其添加到payRequest
,我得到了以下錯誤消息MissingCredentialException
:
Missing credentials for
沒有其他的信息。我究竟做錯了什麼?
編輯:這裏是異常的詳細信息:
PayPal.Exception.MissingCredentialException was unhandled
HResult=-2146233088
Message=Missing credentials for
Source=PayPalCoreSDK
StackTrace:
at PayPal.NVP.PlatformAPICallPreHandler..ctor(Dictionary`2 config, String rawPayload, String serviceName, String method, String apiUserName, String accessToken, String accesstokenSecret)
at PayPal.AdaptivePayments.AdaptivePaymentsService.Pay(PayRequest payRequest, String apiUserName)
at PayPal.AdaptivePayments.AdaptivePaymentsService.Pay(PayRequest payRequest)
at MyApp.PayPalAdapter.PayPerson(Person person, Payment payment, String returnUrl, String cancelUrl) in c:\Projects\MyApp\MyApp\PayPalAdapter.cs:line 50
at MyApp.Scripts.ManagePersonPaymentsJob.PayPerson(Person person, Payment payment) in c:\Projects\MyApp\MyApp.Scripts\ManagePersonPaymentsJob.cs:line 71
at MyApp.Scripts.ManagePersonPaymentsJob.Run() in c:\Projects\MyApp\MyApp.Scripts\ManagePersonPaymentsJob.cs:line 60
at MyApp.Scripts.Program.Main(String[] args) in c:\Projects\MyApp\MyApp.Scripts\Program.cs:line 47
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
你有沒有看過或閱讀完整的文檔[自適應付款Paypal API](https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIntro/) – MethodMan 2014-10-06 21:22:14
需要查看原始請求和響應,包括頭文件。我這樣做很多,並沒有任何問題,所以你必須在某個地方失去一些東西。我會挖掘一個請求,以便我們可以比較。 – 2014-10-06 22:07:23
@DJKRAZE我讀過不少。如果有什麼我明顯錯過的,你能指出嗎? – muttley91 2014-10-07 14:16:57