使用自定义参数的贝宝Notify_url [英] Paypal Notify_url with custom param

查看:80
本文介绍了使用自定义参数的贝宝Notify_url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都知道有一个自定义参数,当来自Paypal的ipn通知来自我们时,它可以检索自定义数据.

As all we know there is a custom param that allow us to retrieve custom data when an ipn notification come from paypal.

但是,我在notify_url中使用了两个参数,这些参数有时会丢失,并且当贝宝向我发送ipn通知时,它就没有这些参数之一.奇怪的是,其中一种参数正确出现.

But also, I am using a couple of params in the notify_url, and those params sometimes get lost, and when paypal send to me the ipn notification, it comes without one of those params. The strange thing is that one of the param come correctly.

因此,第一个问题是:是否可以在notify_url中使用自定义参数,如:

So, first question is: Can I use custom params in the notify_url like:

 notify_url = "www.mydomain.com/paypal/ipn/?param1=one&param2=two"

我想我可以做到,因为它在我的应用程序中失败20次,所以我不知道是否是因为某些浏览器或类似工具不支持它,或者这是一个坏习惯我应该退出.

I suppose that I can do it, because it fails 1 in 20 times on my application, so I do not know if it is because it is not supported by some browsers or something like that, or maybe it is a bad habit I should quit.

有时贝宝将ipn通知发送给:

And sometimes paypal send the ipn notification to:

 notify_url = "www.mydomain.com/paypal/ipn/?param1=one"

没有第二个参数...

Without the second param...

如果我能做到,那么您对这里发生的事情有什么了解...

And if I can do it, do you have any clue about what it is happening here...

谢谢!

推荐答案

我总是避免将数据作为URL参数发送到IPN.可能由于各种原因而无法通过,这意味着无法保证它每次都能正常工作.

I always avoid sending data to IPN as URL parameters. There are various reasons it may not come through, which means there's no guarantee it'll work correctly every single time.

相反,请像您所说的那样使用CUSTOM参数.如果您需要传递多个值,则可以将其作为NVP字符串发送,就像在URL上一样.然后,只需将这些值从IPN脚本中的CUSTOM值中解析出来即可.

Instead, use the CUSTOM parameter like you said. If you need to pass more than a single value you can send it as an NVP string just like you would on your URL. Then just parse those values back out of the CUSTOM value within your IPN script.

或者,您可以将所有需要的数据保存在数据库中,然后将CUSTOM参数中的记录ID发送到PayPal.或者,如果对您有意义,则可以使用INVNUM参数.

Alternatively, you could save all of the data you're going to need in your database and then send the record ID in the CUSTOM parameter over to PayPal. Or you could use the INVNUM parameter if that makes sense for you.

然后在IPN脚本中,根据该记录ID将数据从数据库中拉回.通过这种方式,您始终可以确保它可用,而不必担心在此过程中丢失URL参数.

Then in your IPN script you pull that data back out of the database based on that record ID. This way you're always sure you'll have it available and won't have to worry about losing URL params along the way.

这篇关于使用自定义参数的贝宝Notify_url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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