为什么 Paypal 沙盒不处理付款?
我正在制作一个电子商务网站,贝宝集成似乎正在运行。我有一个购物车,它汇总了里面的所有物品,加上运费,然后用这些行将该数字发送到贝宝。
string address = "https://api-3t.sandbox.paypal.com/nvp?USER=<username>&PWD=<password>&VERSION=71.0&SIGNATURE=<signature>&METHOD=SetExpressCheckout&PAYMENTREQUEST_0_AMT=" + lblTotal.Text + "&PAYMENTREQUEST_0_CURRENCYCODE=USD&RETURNURL=http://www.secretskeletonminiatures.com/checkout.aspx&CANCELURL=http://www.secretskeletonminiatures.com/cart.aspx&PAYMENTREQUEST_0_PAYMENTACTION=Sale";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
然后,我使用 HTTPWebResponse 提取来自 paypal 的响应,解析出令牌并将用户重定向到
Response.Redirect("https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=" + token);
当用户访问 paypal 时,然后登录并点击“立即付款”按钮,然后重定向到我网站的结帐页面。
所以一切看起来都很好。但当我检查沙箱帐户时,实际上没有任何资金被转移。
最常见的原因是重定向 URL 中缺少 useraction=commit 参数,但它确实存在,所以这不是问题。
I'm making an e-commerce site and the paypal integration is seemingly working. I have a shopping cart, that totals up all the items inside, adds the shipping price and then sends that number off to paypal with these lines.
string address = "https://api-3t.sandbox.paypal.com/nvp?USER=<username>&PWD=<password>&VERSION=71.0&SIGNATURE=<signature>&METHOD=SetExpressCheckout&PAYMENTREQUEST_0_AMT=" + lblTotal.Text + "&PAYMENTREQUEST_0_CURRENCYCODE=USD&RETURNURL=http://www.secretskeletonminiatures.com/checkout.aspx&CANCELURL=http://www.secretskeletonminiatures.com/cart.aspx&PAYMENTREQUEST_0_PAYMENTACTION=Sale";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);
Then I pull in the response from paypal with a HTTPWebResponse and parse out the token and redirect users to
Response.Redirect("https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=" + token);
When the user gets to paypal then log in and hit the "Pay Now" button and get redirected to the checkout page of my site.
So everything seems ok. But when I check the sandbox accounts, none of the money is actually getting transferred.
The most common cause is the useraction=commit parameter being missing from the redirect url but it's there so that isn't the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于后来偶然发现这个问题的任何人。
我确实解决了。一旦用户在 PayPal 上确认付款后返回您的网站,您仍然需要向 PayPal 服务器发送 DoExpressCheckoutPayment 请求以处理付款。
您将向 DoExpressCheckoutPayment 提供 PayerID 和 TOKEN 来处理它。 PayerID 附加在您的 RETURNURL 的 URL 中,或者可以通过使用 TOKEN 调用 GetExpressCheckoutDetails 来检索。
To anyone else who stumbles on this question later.
I did solve it. Once the user returns to your site after confirming the payment on paypal you still have to send a DoExpressCheckoutPayment request to the paypal servers to get the payment to process.
You would supply the PayerID and TOKEN to DoExpressCheckoutPayment to process it. The PayerID is appended in the URL of your RETURNURL, or can be retrieved by calling GetExpressCheckoutDetails with the TOKEN.
当我集成 PayPal 时,我遇到了同样的问题,似乎他们的系统进行了一些修改。
如果您转到买家帐户,您可以看到您的付款处于待处理状态,并将在几天内获得批准,商家帐户的行为相同。
I faced same issue when I integrated pay pal and it seems that there has been some modification in their system.
if you go to your buyer account you could see your payments in pending state and to be approved in a couple of days, same behavior for merchant account.