哪个是正确的 - PayPal 文档或他们的 PHP IPN 代码示例?
Which is correct - PayPal documentation or their PHP IPN code samples?
根据 PayPal 的 Implementing an IPN Listener 文档,IPN 侦听器的正确事件顺序是:
- 侦听器收到通知
- 侦听器发送一个空的 HTTP 200 响应
- 侦听器将
cmd=_notify-validate
添加到它收到的通知上,并通过 POST 将其发送回 PayPal
- PayPal 响应
VERIFIED
或 INVALID
- 侦听器适当地处理通知
但是,GitHub 上的示例代码(显然由 PayPal 提供)以不同的顺序执行操作:
- 侦听器收到通知
- 侦听器将
cmd=_notify-validate
添加到它收到的通知上,并通过 POST 将其发送回 PayPal
- PayPal 响应
VERIFIED
或 INVALID
- 侦听器适当地处理通知
- 侦听器发送一个空的 HTTP 200 响应
示例代码是否正确运行?如果不是,为什么 PayPal 引用此代码作为示例?如果是这样,为什么 PayPal 的文档 而不是 反映正确的编码顺序? ...或者顺序无关紧要?
显然答案是 "It doesn't matter which order it's done in" - 只要在超时 window 内收到响应即可。
当我在 https://www.paypal-techsupport.com/:
搜索 "sandbox transactions not sending IPN" 时,我发现隐藏在 PayPal 网站上的此信息是可能的答案之一
How long is the IPN timeout length?
PayPal's Instant Payment Notification (IPN) system expects your web
server to send an HTTP 200 response when the IPN is sent to your IPN
script.
If your server doesn't respond after a certain amount of time, the IPN
system then re-posts the IPN to your script.
The amount of time between each re-post doubles each time: 10 seconds,
20 seconds, 40 seconds, 80 seconds, and so on, up to a maximum of 24
hours. The IPN system stops re-posting when:
- PayPal receives a basic HTTP "200 OK" response from your web server, or
- When approximately four days have passed since the initial post.
请注意,如果您的 IPN 侦听器花费 10 秒以上的时间到达其响应 HTTP 200 结果的位置(如示例代码中所示),那么您正在做一些 非常 错误:IPN 处理程序应该是一个非常快 进程,执行速度尽可能快,尤其是 如果您想处理大量流量。
根据 PayPal 的 Implementing an IPN Listener 文档,IPN 侦听器的正确事件顺序是:
- 侦听器收到通知
- 侦听器发送一个空的 HTTP 200 响应
- 侦听器将
cmd=_notify-validate
添加到它收到的通知上,并通过 POST 将其发送回 PayPal
- PayPal 响应
VERIFIED
或INVALID
- 侦听器适当地处理通知
但是,GitHub 上的示例代码(显然由 PayPal 提供)以不同的顺序执行操作:
- 侦听器收到通知
- 侦听器将
cmd=_notify-validate
添加到它收到的通知上,并通过 POST 将其发送回 PayPal
- PayPal 响应
VERIFIED
或INVALID
- 侦听器适当地处理通知
- 侦听器发送一个空的 HTTP 200 响应
示例代码是否正确运行?如果不是,为什么 PayPal 引用此代码作为示例?如果是这样,为什么 PayPal 的文档 而不是 反映正确的编码顺序? ...或者顺序无关紧要?
显然答案是 "It doesn't matter which order it's done in" - 只要在超时 window 内收到响应即可。
当我在 https://www.paypal-techsupport.com/:
搜索 "sandbox transactions not sending IPN" 时,我发现隐藏在 PayPal 网站上的此信息是可能的答案之一How long is the IPN timeout length?
PayPal's Instant Payment Notification (IPN) system expects your web server to send an HTTP 200 response when the IPN is sent to your IPN script.
If your server doesn't respond after a certain amount of time, the IPN system then re-posts the IPN to your script.
The amount of time between each re-post doubles each time: 10 seconds, 20 seconds, 40 seconds, 80 seconds, and so on, up to a maximum of 24 hours. The IPN system stops re-posting when:
- PayPal receives a basic HTTP "200 OK" response from your web server, or
- When approximately four days have passed since the initial post.
请注意,如果您的 IPN 侦听器花费 10 秒以上的时间到达其响应 HTTP 200 结果的位置(如示例代码中所示),那么您正在做一些 非常 错误:IPN 处理程序应该是一个非常快 进程,执行速度尽可能快,尤其是 如果您想处理大量流量。