Paypal IPN 未调用问题

我遇到了一些关于 Paypal IPN 没有在我的一台服务器上被触发的问题.下面是场景.

I am having some problem regarding Paypal IPN not getting fired on one of my server. Below is the scenario.

1) 我有两个站点,站点 A(旧)在服务器 X 上,站点 B(新)在服务器 Y 上.这两个站点都具有相同的 Paypal 快速结账表提交和 IPN 代码.2) 站点 A 运行顺利,paypal express 结账表格提交,IPN 被正确触发.3) 但是对于站点 B,虽然我们的表单被正确提交并且付款成功,但 IPN 并没有被解雇.

1) I have two sites site A(old) is on server X and site B(new) on server Y.Both the sites having identical Paypal express checkout form submission and IPN code. 2) Site A is running smoothly with paypal express checkout form submission and IPN is get fired correctly. 3) But with Site B, though our form gets submitted correctly and payment is successful, IPN is not getting fired.

更多信息:我检查了 Paypal 的业务 A/c 是否有任何可能需要在 IPN 所在的位置添加 IP/域的功能.

More information : I checked Paypal`s business A/c for any of functionality that may needed to add IP/domain where IPN is located.

我还与 Paypal 支持人员核实过,他们说从 2014 年 3 月 25 日起,他们已告知将 Paypal 的 API 相关 IP 地址添加到我们的服务器防火墙.我们已经添加了这些 IP 地址,但仍然无法正常工作.

I have also checked with Paypal support where they says that from 25 March 2014 they have told to add Paypal`s API related IP address to our servers firewalls. We had done with adding those IP address but still this is not working.

  URL : https://ppmts.custhelp.com/app/answers/detail/a_id/14/related/1/session/L2F2LzEvdGltZS8xNDAxMTcyODkwL3NpZC9VbENEUWhWbA%3D%3D

希望以下信息对您来说足够了.如果我们中的任何人有一些解决方案需要克服,请提出建议.

Hope following information is sufficient for you. Please suggest if any one of us have some solution to overcome.

提前致谢.

推荐答案

不幸的是,没有太多问题的特定信息可供我处理,所以让我们将此作为 IPN 故障排除指南以供将来参考:)

Unfortunately, there's not much issue specific information for me to work with, so lets make this an IPN Troubleshooting Guide for future reference :)

检查给定帐户的 IPN 功能状态 -

Check the IPN feature status for the given account -

https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-ipn-notify(先登录你的账户,然后点击链接进入IPN设置)

https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-ipn-notify (login to your account first, then follow the link to be taken to the IPN Settings)

替代方案:

  • 登录到 PayPal.com
  • 打开个人资料 --> 我的销售偏好
  • 找到即时付款通知"选项

IPN 可以处于四种状态:

There are four states IPN can be in:

  • 已启用 --> 如果系统提示您选择设置,则 IPN 为如果通知 URL 在结帐请求.

  • Enabled --> If you're prompted to choose your settings, IPN is enabled and IPNs will be sent if a notify URL is passed in the checkout request.

使用默认 URL 设置启用 --> 如果显示通知 URL"并将消息传递"设置为启用,则每次您未在结帐请求(例如,eBay 交易将发送到默认 URL,因为 eBay 的 Express Checkout 集成不传递通知 URL)

Enabled with Default URL Set --> If a "Notification URL" is displayed and "Message delivery" is set to enabled, the default URL will be used every time you do not specify a different IPN URL in the checkout request (e.g. eBay transactions will be sent to the default URL because eBay's Express Checkout Integration does not pass a notify URL)

Disabled --> 您从未设置默认 URL,但在您的交易中传递的 IPN URL 引发了太多错误.您应该会看到空的地址字段和选项不接收 IPN 消息(已禁用)"被选中.

Disabled --> You never set the default URL, but IPN URL passed in your transactions has been throwing too many errors. You should see the empty Address field and the option "Do not receive IPN messages (Disabled)" being checked.

使用默认 URL 设置禁用 --> 在某个时间点配置了默认 IPN URL,但由于默认 URL 或动态 URL 上的失败,IPN 功能已被禁用.您将看到 URL 和消息传递 = 已禁用"

Disabled with Default URL Set --> a default IPN URL was configured at some point in time, but due to failures on the default URL or on the dynamic URLs, the IPN feature has been disabled. You will see the URL and "Message Delivery = Disabled"

为什么 PayPal 会禁用 IPN 传送?

PayPal 希望您的服务器以 HTTP-200 OK 消息响应.如果我们收到不同的响应代码,则会启动重试机制.随着每次尝试之间的时间帧的增加,IPN 消息总共发送 16 次.如果一个 URL 的错误达到某个阈值,IPN 将自动禁用.您将收到一封发送至 PayPal 帐户中列出的主要电子邮件地址的电子邮件,警告您即将停用

  1. 如果启用了 IPN,请在 https://www.paypal.com/cgi-bin/webscr?cmd=%5fdisplay%2dipns%2dhistory&nav=0%2e3%2e4

它会显示您的服务器发回的最后一个 HTTP 响应代码,您可以过滤失败/重试的消息.

It'll show you the last HTTP Response Codes your server is sending back and you can filter for failed / retrying messages.

检查 http://en.wikipedia.org/wiki/List_of_HTTP_status_codes 以查看状态的意思.

Check http://en.wikipedia.org/wiki/List_of_HTTP_status_codes to see what the status means.

如果没有 HTTP 响应代码,则说明存在较低级别的连接问题.最常见的原因是:

If there is not HTTP Response code, there's a connection issue on a lower level. Most frequently caused by:

  • 防火墙
  • SSL 连接问题(尝试使用 HTTP)
  • 黑洞路由

如果您觉得一切都配置正确,请查看https://ppmts.custhelp.com/app/answers/detail/a_id/733

If you feel that everything is configured correctly, check out https://ppmts.custhelp.com/app/answers/detail/a_id/733

如果 IPN 消息被标记为已发送"(已收到 HTTP 200),则 IPN 处理的下一步是将数据发回 PayPal 进行验证.您可以在脚本中启用日志记录(将 HTTP 请求和响应转储到服务器上的文件中) - 或者您可以联系 PayPal MTS(https://www.paypal.com/mts )并询问在 PayPal 端可见的内容.

If the IPN messages are marked as "SENT" (HTTP 200 Received), the next step in IPN processing is posting the data back to PayPal for validation. You can either enable logging within the script (dump the HTTP request and response in a file on the server) - or you can contact PayPal MTS ( https://www.paypal.com/mts ) and ask what's visible on the PayPal Side.

检查与 paypal 连接的一个很好的测试是在网络服务器上运行以下命令:

A good test to check the connectivity to paypal is to run the following command on the webserver itself:

curl -d "cmd=_notify-validate" -v https://www.paypal.com/cgi-bin/webscr

curl -d "cmd=_notify-validate" -v https://www.paypal.com/cgi-bin/webscr

如果您看到 POST 已到达 PayPal,但 PayPal 对所有消息都以 INVALID 响应:

If you see that the POST has reached PayPal, but PayPal responds with INVALID for all messages:

检查您的代码,https://github.com/paypal/ipn-code-samples 是一个很好的样本来源

Check your code, https://github.com/paypal/ipn-code-samples is a good source of samples

如果 PayPal 对某些消息的响应为 INVALID,则您可能遇到了编码问题.您最好在 https://www 下设置您的字符编码设置.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding - 将它们设置为 UTF8 以获得最佳效果.

If PayPal responds with INVALID to some messages, you're likely running into an encoding issue. You'd best set your Character Encoding settings under https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding - set them to UTF8 for the best results.

如果 PayPal 响应 VERIFIED,但您的脚本在验证付款后没有继续处理,请确保您运行 TRIM()(或所用语言中的等效项)以删除空格、换行符和CRLF

If PayPal Responds with VERIFIED, but your script doesn't continue processing after validating the payment, make sure you run a TRIM() (or the equivalents in the language being used) to remove whitespace, line feeds and CRLF

之后发生的事情取决于 IPN 脚本,您在连接到数据库、解析 IPN 消息以获取某些数据或某些编码错误时可能会遇到错误.

What happens afterwards is up to the IPN script you may run into errors while connecting to a database, parsing the IPN message for certain data or some coding errors.

简而言之:如果 IPN 消息已被接收、回发和验证,其他所有事情都会发生在您服务器上您自己的代码中,您必须开始挖掘日志文件(或确保日志正在创建,这总是一个好主意)来找出发生了什么.如果问题是可重现的,最好检查其中一个示例脚本(包括日志记录)发生的情况

希望这有助于正面解决 IPN 问题 - 有关 IPN 的任何问题?如果您想调查 paypal 方面的情况,请联系 paypal.com/mts.

Hope this helps tackling IPN issues head on - any questions regarding IPN? Contact paypal.com/mts if you want to investigate what's happening on the paypal side.

相关文章