I am trying to pass custom variables to paypal IPN. I can manage to pass one variable. But i don’t know how to pass multiple variables.
My Process is something like this
- User fill up the form
- They click button and it goes to paypal
- They paid, IPN send me back the information and that ipn.php added variables that passed to the database.
My custom variables are
- total lines (whenever they write, i count the lines)
- message (their message that they wrote)
- advertisement id
But for now, I can only pass one variable like this
form.php
<input name="custom" type="hidden" id="custom" value="{$line_count}"> $_SESSION['line_count'] = $_POST['lines_txt'];
ipn.php
$sql="INSERT INTO `form`(`totalline`) VALUES ('" .$_POST['custom']. "');";
Advertisement
Answer
I am not sure, if it is even possible with Paypal to send and receive multiple variables. If it is not possible due to Paypal’s restrictions, you could use one of the following approaches:
- Send the data serialized, and deserialize on return.
- Write the data to the database in form.php (with status notpaid) and send the id. In ipn.php catch the id and set status = paid / error / whatever happened in the database.