I am using PayPal IPN Listener class which was working great for months, but recently (without any code changes) I received a weird issue.
The following code which validates the Instant Payment Notification throws an Exception: Invalid response status: 403
$listener = new IpnListener();
$listener->use_sandbox = PAYPAL_SANDBOX;
try {
$listener->requirePostMethod();
$verified = $listener->processIpn();
} catch (Exception $e) {
error_log('Process IPN failed: ' . $e->getMessage() . " [".$_SERVER['REMOTE_ADDR']."] \n" . $listener->getResponse());
exit(0);
}
The getResponse() method gives me this information:
HTTP/1.1 403 Forbidden
Server: AkamaiGHost
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 284
Expires: Fri, 19 Sep 2014 08:06:58 GMT
Date: Fri, 19 Sep 2014 08:06:58 GMT
Connection: close
Strict-Transport-Security: max-age=63072000
<HTML><HEAD>
<TITLE>Access Denied</TITLE>
</HEAD><BODY>
<H1>Access Denied</H1>
You don't have permission to access "http://www.paypal.com/cgi-bin/webscr" on this server.<P>
Reference #18.682d1402.1411114018.180f58
</BODY>
</HTML>
I set the PayPal ExpressCheckout API calls with Angelleye library. It's not the most up-to-date version, but it was working just fine so far.
I am generating the link for Express Checkout payment and place it in the HTML. The user is going to PayPal (live and sandbox work the same) through the link, pays and successfully return to my "Thank you" page. The payment is received, but the IPN is failing.
Thanks in advance!