aatelfer wrote:Hey you guys, I did some tests and realized that something is happening inside "
http://servername.com/shop/payment/pp_standard/callback" that is causing a problem.
I created a paypal.php file in the shop root and changed the callback to that url. It seems to be working well.
Something is happening before the callback is called.
Take a look at what I did to sort out this problem:
*** File:
http://servername.com/store/paypal.php ***
// Load the paypal wrapper...found at phpclasses.org
require_once('system/library/paypal.php');
// Test server
$p = new Paypal('
https://www.sandbox.paypal.com/cgi-bin/webscr');
//$p->paypal_url = '
https://www.paypal.com/cgi-bin/webscr';
if ($p->validate_ipn()) {
$request = 'response=' . 'VERIFIED';
foreach ($p->ipn_data as $key => $value) {
$request .= '&' . $key . '=' . urlencode(stripslashes($value));
}
$ch = curl_init('http://'.$_SERVER['SERVER_NAME'].'/shop/index.php?route=payment/pp_standard/callback');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
}else{
$subject = 'Instant Payment Notification - Reception failed';
$to = 'YOUR EMAIL ADDRESS'; // your email
$body = "An instant payment was unsuccessful.\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"; }
mail($to, $subject, $body);
}