Paypal IPN randomly fails

I have a IPN script, written in PHP, that I use to process payments from my website members. For the most part it works great. However, a few times per month certain transactions never come through. So then I have to login to the paypal website, go to the IPN History page, and have it resend the transaction that never made it to my server. They always have a HTTP status code of 200, so paypal employees tell me everything is working fine on their end. I’m not so sure though.

It’s to the point that its costing me a lot of time, having to babysit the process and make sure each transaction actually gets successfully processed by my IPN script. I’m at a loss as to why it works most of the time, but not always. Has anyone else seen this? What kind of suggestions do you have?


Is there something that the ones that fail have in common? If you have multiple paths through your script then perhaps there is an error in one of them causing those payments that follow that path to fail.

As the staff at Paypal told you, the problem is most probably on your side. The chance this is on Paypal’s side is 0.00000000000000001%, as else it would be a wide spread issue.

Keep in mind that if your script fail due to a error, the web server will return a 200 OK http status code.

If you dont already do it, start logging php errors, and then the next time you have one failing, search the error log and you will most probably find the problem.

You can also add error reporting to any critical parts of your IPN script, i.e. database updates, etc. This is more tricky if you dont already have a built in system for error reporting and use it frequently.

Is there anything I can do to my code so that if it does have an error it won’t send a 200 OK status code?