Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing custom variables to paypal IPN

Tags:

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

  1. User fill up the form
  2. They click button and it goes to paypal
  3. They paid, IPN send me back the information and that ipn.php added variables that passed to the database.

My custom variables are

  1. total lines (whenever they write, i count the lines)
  2. message (their message that they wrote)
  3. 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']. "');"; 
like image 655
spotlightsnap Avatar asked Dec 03 '09 08:12

spotlightsnap


1 Answers

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.
like image 152
Residuum Avatar answered Oct 22 '22 20:10

Residuum