4
votes

Site that handles PayPal payments through the IPN API, stopped working today. I use the sample php script provide by paypal to process IPN. After debugging I found that it mas missing the VERIFIED response you receive after submitting the request to confirm a payment notification. And neither was arriving "INVALID".

Finally, after adding code to trace the response, I thought that the actual response had a trailing empty space. This would explain that

if (strcmp ($res, "VERIFIED") == 0)

would'nt hit. Before that I added

$res=trim($res);

and things returned to normal -apparenly-. But I wonder if anyone else has experienced this today. (I am not sure of the exact character[s] that were being added but I just know that trimming the response fixed the problem.

1
if trim fixes it, then there's whitespace in there.Marc B
Marc, if $res were " VERIFIED" wouldn't trim fix it?tru7
yep. that's what I said. if running $res through trim "fixes" the problem, then $res has(/had) whitespace in it.Marc B
Uh! right, I guess I'm tired :-)tru7
Freaking white space after $res made me lose 24 hours of debugging time. How incompetent can PayPal be, to provide this strcmp() sample code without trim() and then not making sure their server reply is clean.adrianTNT

1 Answers

1
votes

I had the same problems. Started on Sunday 7th July 2013, and we just noticed it today. Lot's of records for transactions lost. Thanks for telling us Paypal!

Trimming the $res as mentioned above fixed my IPN script, for now. But I also had problems with my PDT script. The script uses strcmp to look for the response message in the array $lines. It used to be:

if (strcmp ($lines[0], "SUCCESS") == 0){}

but after examining the array it seems that the response message is now located at $lines[1]. So I had to update to the following to get it to work.

if (strcmp ($lines[1], "SUCCESS") == 0){}