IPN message is working for us but PayPal server keeps retrying thinking message failed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On the ones that fail we are getting a complete and valid message from the PayPal server so we are happy on our end. After sending back the verification using PHP Curl the PayPal sends us the usual response and $res is set to "VERIFIED";
I've compared the message in the IPN History of what was sent, to the message we returned to PayPal for verification and they are the same. Nevertheless the PayPal server thinks the transmission failed and keeps trying again.
Our response verification code.
$req = 'cmd=_notify-validate';
foreach ($myPost as $key => $value) {
$value = urlencode($value);
$req .= "&$key=$value";
}
$text = str_replace("&","\n",$req);
$text .= "\n\n\n";
file_put_contents("/srv/www/oiyc.org/public_html/PayPal/payments/paypal_req.txt", $text, FILE_APPEND);
// Step 2: POST IPN data back to PayPal to validate
$ch = curl_init('https://ipnpb.paypal.com/cgi-bin/webscr');
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT,'PHP-IPN-VerificationScript');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
if ( !($res = curl_exec($ch)) ) {
fwrite($fpx,"\nGot " . curl_error($ch) . " when processing IPN data");
fwrite($fpx, "\n\nreq:\n" . $req . "\n");
fclose($fpx);
curl_close($ch);
exit;
}
$text = print_r(curl_getinfo($ch),true);
$text .= "\n\n";
file_put_contents("/srv/www/oiyc.org/public_html/PayPal/payments/curl_getinfo.txt", $text, FILE_APPEND);
curl_close($ch);
- Labels:
-
IPN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How to prompt a "thank you" after using donate button on a website in PayPal Payments Standard
- OXXO payment source error PAYEE_COUNTRY_NOT_SUPPORTED_FOR_PAYMENT_SOURCE error in production in REST APIs
- PayPal Instant Payment Notification Warnings in NVP/SOAP APIs
- Is it safe to re-send messages when the hostname could not be resolved? in REST APIs
- Unable to complete Seller Onboarding in Sandbox in Sandbox Environment