我的 Paypal IPN 付款正在工作(立即购买按钮),但现在我必须为每笔交易在我的数据库中添加一些变量,例如折扣名称、用户 ID 等.过去我使用自定义隐藏字段,因为我只需要用户 ID.但是现在我不知道如何传递这个新的自定义变量并让它们在付款成功时从 Paypal POST 返回?
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
字段,您可以按照建议使用 此处 并由 PayPal 这里:
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.
请参阅此答案.
这篇关于Paypal IPN 自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!