My problem is that my SESSION variables are being destroyed during the Paypal IPN process.
I have successfully written my IPN listener to talk to Paypal and I have no problem manipulating the predefined IPN variables that Paypal POST’s back to me. Despite this, I am having trouble accessing the SESSION variables created before the Paypal payment is made. I assume that they are being destroyed when I connect to Paypal.
I have quite a few variables so it is not feesable to just use Paypal’s ‘custom’ field.
As an example, if I want to send an email to a customer containing a SESSION variable (named $_SESSION[‘order_type’] ) that they created during the ordering process on my site:
<?php
//enable sessions
if (!isset($_SESSION)) {
session_start();
}
**** Accept payment/verify using paypal listener etc****
// If everything is successful and the payment is accepted then send an email containing some previously stored session variables
$mail_From = "From: me@example.com";
$mail_To = "email@email.com";
$mail_Subject = "Your payment has been made successfully” ;
$mail_Body = "you have successfully made a ". $_SESSION['order_type']."order";
mail($mail_To, $mail_Subject, $mail_Body, $mail_From);
?>
My email never contains my session variables leading me to believe that they are being destroyed...please help!
Many thanks,
David