Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal IPN process more than one custom variable

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; ?>">

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; ?>">

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.

like image 646
inrob Avatar asked Jul 24 '12 13:07

inrob


1 Answers

this way you can pass more parameters

<input type="hidden" name="custom" value="variable1=234&var2=summa&etc=xyz"/>

use the above one on your paypal form.

and process through the following code.

 parse_str($_POST['custom'],$_MYVAR);

echo $_MYVAR['variable1'];
echo $_MYVAR['var2'];
echo $_MYVAR['etc'];

i hope this one help you.

like image 77
Varadha Avatar answered Sep 19 '22 20:09

Varadha