贝宝IPN处理多个自定义变量 [英] Paypal IPN process more than one custom variable

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

问题描述

因此,我已经在自己的网站中实现了贝宝IPN,而且我正处于 工作过程.现在我想在pp表单中使用多个自定义变量 目前我只使用这个

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社区中提出的这个建议使用选项变量,该变量似乎提供了键/值对实现,以方便使用多达99个var(对于我实际上没有尝试过的记录这个).

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).

最普遍接受的解决方案(我也很赞成)是将所有数据添加到数据库记录中,然后使用自定义var存储您的记录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.

这篇关于贝宝IPN处理多个自定义变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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