Question

I am trying to test a servlet I wrote that processes a payapal IPN notification (my servlet is very similar to this example) - thing is even after enabling all the settings in the test account I am using the IPN notification is not firing at all.

I then found out that apparently in the sandbox the only way to test IPN is through the IPN simulator. I am trying to use it but I am getting:

IPN delivery failed. HTTP error code 405: Method Not Allowed

Does anyone have the slightest clue?

Also I am seeking ANY advice for testing IPN handlers in a straightforward manner since the IPN simulator kind of sucks (any option you pick it resets all the fields and so forth).

Any help appreciated!

Was it helpful?

Solution

I would check to make sure that your web server is allowing POST requests on your IPN handler URL. In this example, I used the PHP version of the example on the page you linked, and placed the script at /ipn.php.

I then telnet to my server. (replace with your server address)

$ telnet myserver.com 80
Trying myserver.com...
Connected to myserver.com.
Escape character is '^]'.

Paste the following into your telnet session. (replace ipn.php and myserver.com). Add a blank line after the last command.

POST /ipn.php HTTP/1.1
Host: myserver.com
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
HTTP/1.1 200 OK

If you don't see a 200 Status, it means your application is not handling POST requests properly, which is a probable cause of the 405 Error.

You should make sure that you implement a doPost() method in your servlet, as well as a doGet().

If you are able to get the requests working from the IPN simulator, and are ready to move on to sandbox testing, make sure that you have the correct Notify URL and that IPN is enabled under the sandbox seller's profile.

Also, make sure that you IPN Handler is logging INVALID requests as well, so that you know if the request was even initiated.

Finally, make sure that the IPN verification URL is set to https://www.sandbox.paypal.com/cgi-bin/webscr in your servlet. (the URL in the example you posted is https://www.paypal.com/cgi-bin/webscr)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top