如何验证paypal支付成功
我正在尝试获取当客户重定向到我们的网站时传递到我们网站的贝宝交易的交易信息。
我在我的沙盒贝宝帐户设置中打开了自动返回和 PDT。我向 paypal 发布了一个示例交易,它回复了我的返回 URL,并附加了 tx。
正如在一些文档中发现的那样,我对 https://www.paypal.com/cgi- 做了一个curl req bin/webscr 并尝试通过传递 req 值来获取信息,如下所示:
a.) tx = same one received from paypal
b.) at = pdt code given by paypal while turning pdt on
c.) cmd= "_notify-synch"
但结果我得到 String(0) ""。
我缺少什么?
I am trying to get the transaction info of paypal transaction that is passed to our website when customer is redirected to our website.
I turned auto-return and pdt in my sandbox paypal account setting. I posted a sample transaction to paypal and it replied to my return url with tx appended.
As found in some docs I did a curl req to https://www.paypal.com/cgi-bin/webscr and tried to get information by passing the req values as follows:
a.) tx = same one received from paypal
b.) at = pdt code given by paypal while turning pdt on
c.) cmd= "_notify-synch"
but in result i get String(0) "".
What I am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我强烈建议您考虑使用 PayPal 即时付款通知 (IPN)。
PayPal IPN 允许您(异步)处理订单信息,而不必依赖买家返回您的网站来完成订单。
您可以通过设置从 PayPal 接收此 (POST) 数据的脚本来使用 IPN。此外,您必须在按钮和/或 API 调用中包含以下代码:
对于网站付款标准(其中“xxxxxxxx”是 IPN 脚本的完整 URL):
输入类型=“隐藏”名称=“notify_url”值=“xxxxxxxx”
对于快速结账:
在您的 SetExpressCheckout 和 DoExpressCheckoutPayment API 调用中包含 NOTIFYURL=xxxxxxxx
对于 Website Payments Pro
在 DoDirectPayment API 调用中包含 NOTIFYURL=xxxxxxxx
您可以在 https:// 找到有关 PayPal IPN 的示例代码、文档和更多信息。 www.paypal.com/ipn
此外,这里有一篇文章,其中包含有关验证 IPN 消息真实性的附加步骤,网址为 https://www.x.com /developers/community/blogs/ppmtsrobertg/secure-your-instant- payment-notification-ipn-script
I'd highly suggest looking into using PayPal Instant Payment Notifications (IPN).
PayPal IPN allows you to (asynchronously) process order information while not having to depend on the buyer to return to your website to complete the order.
You can use IPN by setting up a script which receives this (POST) data from PayPal. In addition, you must include the following code in your button and/or API call(s):
For Website Payments Standard (where "xxxxxxxx" is the full URL to your IPN script):
input type="hidden" name="notify_url" value="xxxxxxxx"
For Express Checkout:
Include NOTIFYURL=xxxxxxxx in your SetExpressCheckout and DoExpressCheckoutPayment API call
For Website Payments Pro
Include NOTIFYURL=xxxxxxxx in your DoDirectPayment API call
You can find sample code, documentation and further information on PayPal IPN at https://www.paypal.com/ipn
Additionally, here's an article with additional steps on verifying the authenticity of IPN messages at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script