PayPal 自动退货不会发回任何 POST 数据
我有一个与这篇文章类似的问题
但是,那里的解决方案不起作用。我们设置了 IPN,并且 POST 变量被传回(访问者点击返回并能够下载购买的 PDF 文件),但随后我尝试摆脱 Paypal 订单确认页面,该页面显示
您刚刚完成付款。您此次付款的交易 ID 是:XXXXXXXXXXXXXXX。
并在网站付款首选项中启用“自动退货”,指定 URL http://www.educted.ca/ payment_complete.php,POST 变量现在不会传递回 payment_complete.php - 它显示空白。一旦我禁用“自动返回”,POST 变量就会正确显示,并且可以下载购买的产品。当然,我使用的是 Paypal Sandbox 帐户。
<input type="hidden" name="return" value="<?php echo LIVE_SITE;>payment_complete.php">
<input type="hidden" name="cancel_return" value="<?php echo LIVE_SITE; ?>catalog.php">
<input type="hidden" name="notify_url" value="<?php echo LIVE_SITE; ?>ipn.php">
<input type="hidden" name="rm" value="2">
有什么想法吗?
I have a similar problem to this post
Setting PayPal return URL and making it auto return?
However, the solution there is not working. We have IPN set up and POST variables get passed back (the visitor clicks back and is able to download purchased PDF files) but then I tried to get rid of Paypal order confirmation page that says
you just completed your payment. Your transaction ID for this payment
is: XXXXXXXXXXXXX.
and enabled "Auto Return" in Website Payment Preferences, specifying the URL http://www.educted.ca/payment_complete.php, the POST variables now do not get passed back to payment_complete.php - it shows blank. As soon as I disable "Auto Return", POST variables display properly and products purchased can be downloaded. I am using Paypal Sandbox account, of course.
<input type="hidden" name="return" value="<?php echo LIVE_SITE;>payment_complete.php">
<input type="hidden" name="cancel_return" value="<?php echo LIVE_SITE; ?>catalog.php">
<input type="hidden" name="notify_url" value="<?php echo LIVE_SITE; ?>ipn.php">
<input type="hidden" name="rm" value="2">
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您启用自动返回,则无论
rm
设置为何,这些值始终会通过 GET 返回。如果您想在买家完成交易后立即发送文件,请查看 PayPal 付款数据传输。启用后,PDT 会将
tx
GET var 添加到您的返回 URL;通过致电 PayPal https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx=value-for-tx-here&at=value-for-your-paypal-account-authentication-token< /a>您将能够提取有关交易的额外数据,并立即检查其是否有效。另请参阅 https://www.paypal.com/pdt/
IPN 应保留用于后端处理,因为它可能带有严重延迟。
另一方面,PDT 让您从 PayPal 获取信息,因此是即时的。
If you enable Auto Return, the values are always going to get returned via GET irrespective of what
rm
is set to.If you want to do immediate file delivery after the buyer has completed the transaction, have a look at PayPal Payment Data Transfer. Once enabled, PDT adds a
tx
GET var to your return URL; by calling PayPal at https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx=value-for-tx-here&at=value-for-your-paypal-account-authentication-token you'll be able to pull in extra data about the transaction, and immediately check whether it's valid.See also https://www.paypal.com/pdt/
IPN should be reserved for backend processing as it can come with a significant delay.
PDT, on the other hand, has you pulling the info from PayPal, and is as such immediate.
您仍然可以将“自动返回”设置为“开”,但请确保禁用 PDT,并且您将通过 POST 发送到您的返回 URL 的所有交易变量(当然,如果您在请求中将 rm 参数设置为 2,因为您说你有)。
由于某种原因,启用 PDT 将忽略 rm 参数并强制使用 GET 方法。
You can still keep Auto Return set to On, but make sure you DISABLE PDT, and you will get all the transaction variables sent to your return URL via POST (if you have the rm parameter set to 2 in your request of course, as you said you have).
For some reason, enabling PDT will ignore the rm parameter and force the GET method to be used.
这是正确答案!如果您想获取 POST-Data,则不得启用通过自动响应发送付款数据。
但是,在这种情况下,您必须使用 https 站点,否则客户在重定向之前会收到警告!
This is the correct answer! You must not enable sending payment data with auto response, if you want get POST-Data.
BUT, in this case you have to use a https-site, otherwise the customer get a warning before redirecting!
在您的特定情况下,由于代码中存在错误,它显示为空白:
这不会解析为有效的 PHP - 它会导致致命错误。如果尚未输出任何信息并且错误报告已关闭,则它将是一个空白页。
In your particular case, it was showing blank because of an error in your code:
That doesn't parse as valid PHP - it'd cause a fatal error. If no information has been output yet and error reporting is off, it'll be a blank page.