贝宝IPN自定义变量 [英] Paypal IPN custom variables
问题描述
我的Paypal IPN付款正在运行(立即购买按钮),但是现在我必须在数据库中为每笔交易添加一些变量,例如折扣名称,用户ID等.过去,我只使用用户ID来使用自定义隐藏字段.但是现在我不知道如何传递这个新的自定义变量,如果支付成功,则让它们从Paypal回发吗?
My Paypal IPN payement is working (buy now button) but now I have to add some variables, like the discount name, the user ID, etc... in my database for each transaction. In the past I used the custom hidden field as I just need the user ID. But now I don't know how to pass this new custom variables and have them POST back form Paypal if the payement succeed ?
感谢您的帮助!
推荐答案
您有三个主要选择:
-
使用标准的
custom
隐藏字段将所需的所有数据存储在一个字符串中.您可以使用JSON格式或其他等效格式.可变大小限制为256个字符,这听起来可能就足够了.
Use the standard
custom
hidden field to store all the data you need in one string. You could use JSON format or some equivalent. The variable size is limited to 256 characters, which sounds like it might be enough.
在custom
字段中存储唯一的ID,然后使用该ID查找您存储在数据库中的其他数据.
Store a unique id in the custom
field, and use this id to look up the other data that you've stored in your database.
还有其他option
字段,您可以根据建议使用此处:
There are also additional option
fields you can use as suggested here and explained by PayPal here:
您可能还可以将某些标准PayPal字段用于其预期目的之外的目的(即,隐藏您的数据),但是我想这是非常可疑的,完全没有必要.
You could possibly also use some of the standard PayPal fields for purposes other than that for which they were intended (i.e., to hide your data), but this is highly dubious and entirely unnecessary, I would imagine.
请参见此答案.
这篇关于贝宝IPN自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!