IPN 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
Looking at the IPN history page on the PayPal website it reports that certain reports are failing. This is using code on our server that has been working for years. PHP + Curl. Not all IPN messages are treated this way, only from payments originating for one class of activity. All the others are working.
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);
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- 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
- Migrate from Adaptive Payments to Commerce Platform in REST APIs
- What Notification URL is Used for Retrying IPN Messages? in PayPal Payments Standard
- IPN message is working for us but PayPal server keeps retrying thinking message failed. in PayPal Reporting