paypal ipn 通知两次 [英] paypal ipn notification twice

查看:22
本文介绍了paypal ipn 通知两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的通知脚本启动了两次,第一次是 VERIFIED,第二次是 INVALID.

My notification script is launched twice first is VERIFIED and second INVALID.

我尝试了不同的 ipn 验证脚本,但总是得到两次.

I've tried different ipn validation scripts and always get it twice.

我正在使用沙盒,也许卖家帐户设置不正确?我已经使用通知 url 和自动返回设置了 IPN.同样在表单中有 return 和 notify_url set

I'm using sandbox maybe seller account settings are not right? I've set IPN on with notify url and auto return. Also in form there is return and notify_url set

推荐答案

我记得在文档中它指出重复是可能的——这就是互联网的本质.这就是它为您提供唯一交易 ID 的原因.如果您收到两次通知,您应该使用它来防止不好的事情发生.

I remember in the documentation it states that duplicates are possible -- that's just the nature of the internet. That's why it gives you a unique transaction ID. You're supposed to use that to prevent bad things from happening if you get notified twice.

一个更好的问题可能是:为什么它说已验证然后无效?或者可以吗?

A better question might be: why does it say Verified and then Invalid? Or is that ok?

编辑

文档说PayPal发送单字回复,​​如果消息来自 PayPal,则为 VERIFIED,如果与最初发送的内容有任何差异,则为 INVALID".我猜你的代码不小心将回声"发送回 PayPak 两次,其中一个是格式错误的.也许它们都是相同的,但如果 PayPal 收到两次,它会以 INVALID 响应.但是不管怎样,对于特定的交易 ID,一旦你得到验证,你就很好.只需忽略所有后续响应.

The docs say "PayPal sends a single word back, which is either VERIFIED if the message originated with PayPal or INVALID if there is any discrepancy with what was originally sent". I'm going to guess that YOUR code accidentally sends the "echo" back to PayPak twice and one of them is malformed. Maybe they're both identical but PayPal responds with INVALID if it gets it twice. But no matter, for a particular transaction Id, once you get VERIFIED, you're good. Simply ignore all subsequent responses.

编辑 2

返回 url 只是由 PayPal 用来将用户重定向回您的站点.使用此页面感谢他们的购买,并通知他们在处理完成后将收到通知.如果您不想要此功能,您甚至可以将其设置为空字符串.当付款实际完成(或发现某些问题)时,PayPal 将调用通知 url 引用的脚本.在这里,您可以确保一切正常、处理重复通知、更新数据库、向用户发送电子邮件说他们的付款已处理等.

The return url is simply used by PayPal to redirect the user back to your site. Use this page to thank them for their purchase and inform them they will be notified once processing is complete. You can even set this to an empty string if you don't want this feature. When Payment is actually complete (or some problem was identified), PayPal will invoke the script referenced by the notify url. This is where you make sure everything looks right, handle duplicate notifications, update your database, send an email to the user saying their payment was processed, etc.

这篇关于paypal ipn 通知两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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