I’m currently writing an IPN script in PHP to automatically process Paypal payments. On this site
Paypal mentions that you have to send a “200 OK response” back to Paypal. In all the IPN scripts that I have found on the Internet I have never seen they send a “200 OK response” back to Paypal. Does any one know how to send a “200 OK response” to Paypal with PHP?
I don’t know anything about paypal, but looking at
this shouldn’t be too hard.
Maybe something like
header('HTTP/1.0 200 OK');
but I’m guessing more likely
All the paypal IPN scripts I have seen use a socket call to pass the fields passed to it back to Paypal and only continue when they get a “Verified” response.
Every web page/image etc that does not return a error header when fetched will automatically return a 200 OK header response.
So you do not need to worry about the 200 OK header (sure you can include it if you want), BUT you should make certain that you return an error header if you for example are not able to connect back to paypal to verify the transaction, as if you do not do this paypal will believe everything is ok and will not send the transaction over again.
Returning an error header in the event you need the data posted again is something you need to do with any IPN solution out there. This is something that should have been common knowledge, but for some reason its not.
Though, do yourself a favor and include it at once. That way you dont need to come back here asking why your IPN script from time to time does not mark a payment as paid.