Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal IPN _notify-validate throws Error 302 in Sandbox

The second IPN response after sending cmd=_notify-validate to www.sandbox.paypal.com returns HTTP Error 302.

If I change the URL to www.paypal.com, it returns INVALID response. I am not sure where I am wrong.

Should I use www.paypal.com as a host to validate the IPN in sandbox? I don't think so?

I am really struggling to get this sorted. Any help please?

like image 559
fakhrizaki Avatar asked Nov 08 '11 06:11

fakhrizaki


2 Answers

I had the same issue and it appears that sandbox has switched to ssl. I had to change my code from:

$fp = fsockopen ($paypalUrl, "80", $errno, $errstr, 30);

to:

$fp = fsockopen ('ssl://'.$paypalUrl, "443", $errno, $errstr, 30);

and it worked. I found this solution at http://www.jomres.net/jomres-forum/General-discussion/10590-PayPal-IPN----IP-Address-Expansion

like image 109
periklis Avatar answered Nov 10 '22 19:11

periklis


That's not an HTTP error, that's the HTTP response code for accessing https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate

You should be looking at the contents of the page, not the HTTP response code.

like image 1
Robert Avatar answered Nov 10 '22 19:11

Robert