2014-07-14 62 views
0

我想在付款結帳後支付paypal付款ID,執行付款,但我不知道該怎麼辦?如何在結帳後獲得付款ID PayPal

付款ID是在這裏被使用:

pymnt = new Payment(); 
pymnt.id = **PAYMENT_ID**; 
PaymentExecution pymntExecution = new PaymentExecution(); 
pymntExecution.payer_id = context.Request.Params["PayerID"]; 
Payment executedPayment = pymnt.Execute(apiContext, pymntExecution); 
context.Response.Write(JObject.Parse(executedPayment.ConvertToJson()).ToString(Formatting.Indented)); 

回答

0

你應該看看這裏https://developer.paypal.com/docs/integration/web/accept-paypal-payment/

在最後,他們有

當用戶批准支付,貝寶將用戶重定向到創建付款時指定的return_url。付款人ID被附加到返回URL,如PayerID:

的http://令牌= EC-60U79048BN7719609 & PayerID = 7E7MGXCWTTKK2

當你執行不需要追加到返回URL的令牌值?付款。

要在用戶批准後執行付款,請進行付款/執行/呼叫。在請求的正文中,使用附加到返回URL的payer_id值。在>標題中,使用創建付款時使用的訪問令牌。

+0

生成,但我怎麼能使請求執行?我不知道... – Severiano

0

我認爲,貝寶的文檔並不清楚這一點。但是你可以做一些簡單的事情來解決你的問題,通過返回url中的參數傳遞PaymentID。

像這樣:return_url = 'http://www.yourdomain.com/paypal/success/?paymentID=PAY-1234567'

當貝寶重定向到您的網站,那麼,它將連同其他參數返回paymentID。

+0

我無法傳遞該參數,因爲這是我提交結帳aproval後,這是在paypal支付,然後作爲回報,他帶來PayerID和令牌 – Severiano