Hi,
In our site we using PayPal Website Payment Standard to integrated the Payment. Also enabled the IPN for payment notification. But we didn't receive any payment notification from PayPal sandbox site from last month (September 2011). The following is the code snippet we used in our project.
Please help us if any body find a solution for Paypal Sandbox site IPN issue.
switch ($_GET['action']) {
case 'process':
// payment process
break;
case 'success':
// paymetn success
break;
case 'cancel':
// cancel case
break;
case 'ipn':
if ($p->validate_ipn()) {
$subject = 'Instant Payment Notification - Recieved Payment';
$to = 'testpaymentipn@testdomain.com'; // your email
$body = "An instant payment notification was successfully recieved\n";
$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
$body .= " at ".date('g:i A')."\n\nDetails:\n";
foreach ($p->ipn_data as $key => $value) {
$body .= "\n$key: $value";
$fields[] = $key;
$values[] = $value;
}
$str_val = "";
$ncnt = count($values);
for($i=0;$i<$ncnt;$i++)
{
if($i <= ($ncnt-2)) {
$str_val .= "'" . $values[$i] . "',";
} else {
$str_val .= "'" . $values[$i] . "'";
}
}
mail($to, $subject, $body);
} else {
$subject = "Paypal IPN failed - SNG";
$to = "ttestpaymentipn@testdomain.com";
$message_body = "IPN Failed.";
mail($to, $subject, $message_body);
}
break;
}
Thanks,
ephronsng.