付款成功后,PayPal POST数据

时间:2023-01-18 07:53:35

I am trying to make an PHP app, that will interact with MySQL. I already have an page that gets POST data, and after it gets it, it gives "credit" to user. Can PayPal button after successful order send me an post data? or is there any other way? (most likely simplier and more secure)

我正在尝试制作一个PHP应用程序,它将与MySQL交互。我已经有一个获取POST数据的页面,在获得它后,它给用户“信用”。成功下单后可以用PayPal按钮发送一个帖子数据吗?或者还有其他方法吗? (最简单,更安全)

1 个解决方案

#1


4  

Yes, have a look at PayPal Instant Payment Notification (IPN) - https://www.paypal.com/ipn/
This will force a POST of transactional data to be sent to you whenever a transaction has been initiated. If you currently use Website Payments Standard (HTML based buttons), you can simply add

是的,请查看PayPal即时付款通知(IPN) - https://www.paypal.com/ipn/这将强制在交易启动时向您发送交易数据的POST。如果您当前使用网站付款标准(基于HTML的按钮),您只需添加即可

<input type="hidden" name="notify_url" value="http://full-URL-to-the-script-you-set-up-for-IPN">

You'll need to take all POST data you received from PayPal, append cmd=_notify-validate and send it back to https://www.paypal.com/cgi-bin/webscr (or https://www.sandbox.paypal.com/cgi-bin/webscr for Sandbox) in order to validate the IPN message.
Depending on this result, you'll get back an INVALID or VERIFIED response.
INVALID may mean the IPN POST didn't originate from PayPal, whereas VERIFIED means the IPN POST was verified as indeed coming from PayPal.

您需要获取从PayPal收到的所有POST数据,附加cmd = _notify-validate并将其发送回https://www.paypal.com/cgi-bin/webscr(或https://www.sandbox。 paypal.com/cgi-bin/webscr for Sandbox)以验证IPN消息。根据此结果,您将获得INVALID或VERIFIED响应。 INVALID可能意味着IPN POST不是来自PayPal,而VERIFIED意味着IPN POST被验证为确实来自PayPal。

#1


4  

Yes, have a look at PayPal Instant Payment Notification (IPN) - https://www.paypal.com/ipn/
This will force a POST of transactional data to be sent to you whenever a transaction has been initiated. If you currently use Website Payments Standard (HTML based buttons), you can simply add

是的,请查看PayPal即时付款通知(IPN) - https://www.paypal.com/ipn/这将强制在交易启动时向您发送交易数据的POST。如果您当前使用网站付款标准(基于HTML的按钮),您只需添加即可

<input type="hidden" name="notify_url" value="http://full-URL-to-the-script-you-set-up-for-IPN">

You'll need to take all POST data you received from PayPal, append cmd=_notify-validate and send it back to https://www.paypal.com/cgi-bin/webscr (or https://www.sandbox.paypal.com/cgi-bin/webscr for Sandbox) in order to validate the IPN message.
Depending on this result, you'll get back an INVALID or VERIFIED response.
INVALID may mean the IPN POST didn't originate from PayPal, whereas VERIFIED means the IPN POST was verified as indeed coming from PayPal.

您需要获取从PayPal收到的所有POST数据,附加cmd = _notify-validate并将其发送回https://www.paypal.com/cgi-bin/webscr(或https://www.sandbox。 paypal.com/cgi-bin/webscr for Sandbox)以验证IPN消息。根据此结果,您将获得INVALID或VERIFIED响应。 INVALID可能意味着IPN POST不是来自PayPal,而VERIFIED意味着IPN POST被验证为确实来自PayPal。