Paypal IPN 处理多个自定义变量 [英] Paypal IPN process more than one custom variable
问题描述
所以我已经在我的网站中实施了 paypal IPN 并且我处于中间工作过程.现在我想在 pp 表单中使用 1 个以上的自定义变量目前我只用这个
So I've implemented paypal IPN in my site and I'm in the middle of the work process. Now I want to use more than 1 custom variable in the pp form currently I'm using this one only
<input type="hidden" name="custom" value="<?php echo $user_id; ?>">
所以我知道允许使用名称为custom"的变量.我想知道是否我可以传递更多变量,以便我可以根据他们的标准过滤付款.因此,例如,如果运费超过 0.00 美元,我会像这样设置一个变量shipping_cost":
So I know the variable with the name 'custom' is allowed. I want to know if I can pass more variables so I can filter the payments based on their criterias. So if for example shipping is more than $0.00 I set a variable "shipping_cost" like this:
<input type="hidden" name="shipping_cost" value="<?php echo $cost; ?>">
或用于其他目的.这是允许的吗?或者 paypal 已经定义了允许的列表我们可以使用的变量?我真的很想解决这个问题,因为并不总是一种类型我们可以处理的付款...谢谢各位.
or for other purposes. Is this allowed? Or paypal has an already defined list of allowed variables we can use? I really want to solve this problem as there's not always one type of payment we can process... Thank you guys.
推荐答案
当我(以及我想象的许多其他人)也面临这个问题时,我想我会分享一些我遇到的解决方案.
As I (and many others I imagine) am also facing this problem, I thought I'd share some solutions I came across.
这个 在 PayPal 社区中提出,建议使用 Option Variables,它似乎提供了一个键/值对实现,以促进多达 99 个变量(记录我实际上没有尝试过这个).
This one raised in the PayPal Community, suggests the use of the Option Variables which appear to offer a key/value pair implementation to facilitate up to 99 vars (for the record I have not actually tried this).
最普遍接受的解决方案(我也赞成)是将您的所有数据添加到数据库记录中,然后使用自定义变量来存储您的记录 ID,这显然可以在以后使用(例如通过 IPN)来检索您的数据.
The most commonly accepted solution (which I also favor) is to add all of your data to a DB record, then use the custom var to store your record ID, which can obviously be used later (e.g. via IPN) to retrieve your data.
这篇关于Paypal IPN 处理多个自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!