如何验证贝宝的成功付款 [英] How to verify successful payment of paypal

查看:78
本文介绍了如何验证贝宝的成功付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取将客户重定向到我们网站时传递到我们网站的贝宝交易的交易信息.

I am trying to get the transaction info of paypal transaction that is passed to our website when customer is redirected to our website.

我在沙盒Paypal帐户设置中启用了自动返回和pdt.我向Paypal发布了一个示例交易,它回复了我的返回网址,并附加了tx.

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.

在某些文档中发现,我对 https://www.paypal.com做了卷曲的要求/cgi-bin/webscr ,并尝试通过传递req值来获取信息:

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"

但是结果是我得到String(0)".

but in result i get String(0) "".

我想念什么?

推荐答案

我强烈建议您考虑使用PayPal即时付款通知(IPN). 使用PayPal IPN,您可以(异步)处理订单信息,而不必依赖买家返回您的网站来完成订单.

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.

您可以通过设置脚本来使用IPN,该脚本从PayPal接收此(POST)数据.此外,您必须在按钮和/或API调用中包含以下代码:

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):

对于网站付款标准"(其中"xxxxxxxx"是IPN脚本的完整URL):
输入type ="hidden" name ="notify_url" value ="xxxxxxxx"

For Website Payments Standard (where "xxxxxxxx" is the full URL to your IPN script):
input type="hidden" name="notify_url" value="xxxxxxxx"

对于Express Checkout: 在您的SetExpressCheckout和DoExpressCheckoutPayment API调用中包括NOTIFYURL = xxxxxxxx

For Express Checkout: Include NOTIFYURL=xxxxxxxx in your SetExpressCheckout and DoExpressCheckoutPayment API call

对于网站付款专业版 在您的DoDirectPayment API调用中包括NOTIFYURL = xxxxxxxx

For Website Payments Pro Include NOTIFYURL=xxxxxxxx in your DoDirectPayment API call

您可以在 https://www.paypal.com/上找到有关PayPal IPN的示例代码,文档和更多信息. 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

这篇关于如何验证贝宝的成功付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆