PayPal IPN返回购物车或订单ID进行后处理 [英] PayPal IPN returning a shopping cart or order ID for post-processing

查看:273
本文介绍了PayPal IPN返回购物车或订单ID进行后处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地将我的自定义购物车发布到了PayPal上-它可以很好地处理订单,并且在收到付款后,它将数据发布回我在配置中指定的URL.该代码基于以下库: http://www.phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2checkout/

I have successfully posted my custom shopping cart to PayPal -- it processes the order just beautifully, and when the payment is received, it posts data back to the URL I specified in the config. The code is based on the library found here: http://www.phpfour.com/blog/2009/02/php-payment-gateway-library-for-paypal-authorizenet-and-2checkout/

因此,我通过将数据发布回PayPal来成功验证IPN,这一切都很棒.这是我的难题–我怎么知道IPN正在确认哪个订单?

So I'm successfully verifying the IPN by posting data back to PayPal -- that is all great. Here's my dilemma -- how do I know what order the IPN is confirming?

我没有使用PayPals购物车,我有自己的购物车.它在数据库中有它自己的购物车ID,当我收到该购物车的IPN时,我想关闭"购物车并将其保存为订单,以便以后查询.

I am not making use of PayPals shopping cart, I have my own. It has it's own cart ID in my database, and when I receive an IPN for that cart, I'd like to "close" the cart and save it as an order to be looked up at a later date.

我尝试传递一个附加的自定义字段以及重定向到填充购物车的PayPal,但是该值在IPN中没有返回给我. x.com上的文档非常缺乏,所以我在那找不到任何帮助.

I've tried passing an additional custom field along with the redirect to PayPal that populates the cart, but that value isn't returned back to me in the IPN. The documentation on x.com is just plain lacking so I've found no help there.

有人在使用PayPal和IPN方面有经验吗?不必一定是PHP的-我可以解释代码-但是,如果您有一种方法可以通过订单将值发送到PayPal,然后用IPN返回该值,那就太棒了!

Does anyone have any experience with PayPal and IPN? Doesn't necessarily have to be with PHP -- I can interpret code -- but if you have a way to send a value to PayPal with an order and then have that value returned with the IPN, that is AWESOME!

如果使用PayPal的API无法做到这一点(我很难相信)-关于如何处理此问题的其他建议?

If this isn't possible with PayPal's API (which I would find hard to believe) -- any other suggestions on how to handle this?

推荐答案

我不知道这是否是个好主意,但是有几个不同的选择:

I do not know if this is a good idea or not, but here are a couple different options:

A:对项目1使用第一套on1/os1,然后在其中添加订单ID.

A: Use the first set of on1 / os1 for the item 1 and add the order id to that.

B:在自定义字段中,我不确定您那里有什么,但是您可以在此处输入诸如orderidhere41 | otheritems之类的内容,然后通过在| |处进行分解将其解析出来.使他们分开.

B: In the custom field, I am not sure what you have in there, but you can make it something like orderidhere41|otheritems here and then just parse this out by exploding at the | to get them separated.

Paypal确实限制了这一点,我不知道为什么,但是两者都应该起作用.以on/os的方式进行操作会将其放在用户的贝宝收据上,因此这是我的首选方法.

Paypal does limit this, and I do not know why, but both of those should work. Doing it as an on / os will put it on the paypal receipt for the user, so that is my preferred method.

如果其他人有更好的解决方案,我也会对此感兴趣.

If someone else has a better solution, I would be interested in it as well!

澄清on 1 os1.这些是通常用于大小"/颜色等的选项".请参见 IPN PDT Paypal变量(位于option_name1 option_selection(sp)下)以获取有关它们的更多信息.当然,名称是标题,标题将是订单ID",而os将是实际ID.

Clarifying on1 os1. These are "options" generally used for Size / color etc. See IPN PDT Paypal variables under option_name1 option_selection(sp) for more information on them. The name of course is the title which would be "Order ID" the os would be the actual id.

浏览该文档$my2CO->addField('cart_order_id', rand(1, 100));是我放置自己的购物车订单ID的地方.那应该是正确的领域.抱歉给您带来的困惑:)

Looking through that documentation $my2CO->addField('cart_order_id', rand(1, 100)); is where I would put my own cart order id. That should be the correct field. Sorry for the confusion :)

最后,有一个用于Paypal IPN的自定义字段,称为自定义",将向其中添加数据,这将在您之间来回传递订单ID.双方都必须将其称为自定义".

In the end there is a custom field for the paypal IPN, called "custom" adding data to this will pass through, this will transfer the orderid for you to and from. It must be called custom on both sides.

这篇关于PayPal IPN返回购物车或订单ID进行后处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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