So, this is a new one on me. My Paypal IPN has been working for sometime, and started getting an error today.
During the postback to verify with PayPal (adding cmd=_notify-validate), the PayPal responder says "no that wasn't from me". The only thing bizarre about this particular entry is (I believe) the way the user specified their address:
123 Address Street
#789
Everything else seems normal and the IPN-handler is handling other notifications quite happily.
Anyone seen anything like this?
Okay, so I've found my error, and yes, it is related to the newline in the address.
Basically I was doing this:
foreach ($post_array as $name => $value) {
$value = urlencode($value);
$post_string .= $name . '=' . $value . '&';
}
$post_string .= "cmd=_notify-validate";
When I needed to also convert the /n
to a /r/n
, like so:
foreach ($post_array as $name => $value) {
$value = urlencode(str_replace("\n", "\r\n", $value));
$post_string .= $name . '=' . $value . '&';
}
$post_string .= "cmd=_notify-validate";
Now PayPal is happy.
Le sigh.