USBSwiper Home » How to Test PayPal Instant Payment Notification (IPN)
Questions? Call (224) 677-0283

How to Test PayPal Instant Payment Notification (IPN)

Some of the questions I see most in the PayPal developer forum regarding IPN is how to initially configure it and test it. In a previous blog I posted a PHP IPN template that you can use to get passed most of the configuration hurdles. Testing your solution is another story, though. Here are the steps I like to take to ensure flawless IPN integration.

1 – Local IPN Testing

The first thing I do is create a local HTML form that consists of hidden fields which resemble the same thing PayPal’s system would post to my server when an IPN occurs.  Here’s a sample.

[sourcecode language=”html”]


When testing this way, the IPN script will run through your Invalid IPN code because the post did not come from PayPal’s server. As such, you’ll need to adjust your IPN script to force a Valid response. If you’re using my IPN template you can adjust line 56 to…

[sourcecode language=”php”]

if(strcmp ($res, “VERIFIED”) == 0 || 1 == 1)


Then, simply set the action of the form to your IPN listener and then submit it. This way you’ll be able to see the on-screen result of your IPN script and can easily troubleshoot any errors that may exist. You can add or remove any fields you’d like from the test form and you can adjust the names according to what fields you expect to get from the IPN you’re testing for. Once you’re able to successfully run your test IPN within a browser without any errors you can remove the forced Validity and move on to the next step.

2 – PayPal Developer IPN Simulator

PayPal provides an IPN Simulator from within your developer account. You can use the simulator to easily send test IPN’s to your server for a number of different scenarios. At this point you’ll just need to make sure your IPN script is configured to run on the sandbox servers (see the notes at the top of the IPN template) and then these IPN Simulator posts will validate because they are indeed coming from PayPal’s server. Once these simulated IPN’s are working as expected you’re ready to launch.

3 – Deploy

At this point you’re ready to set your IPN script to production mode instead of sandbox mode and then upload it to your live web server. You can enable IPN within your PayPal profile or you can also include the NotifyURL field in your standard payment buttons or API requests to PayPal.

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
Tags: , , ,

6 Responses

  1. Bill says:

    This was fantastic! Thank you very much for providing this. Got me set up perfectly.

  2. Kenny K says:

    Nicely done. I had the idea in mind, but I wanted to check the internet for someone who already wrote out the form code. Thanks!

  3. roywill46 says:

    Hello Andrew,

    First, thanks so much for IPN solution! It has been a huge asset in implementing IPN for my site. Currently, I’m working on the final testing.

    I am experiencing a db problem which is probably simple but I’ve yet to find a fix. When I run a test transaction, the paypal_ipn_raw_log is updated, but not the paypal_ipn_orders table. The require_once is in the ipn_listener. When I checked my log file I noticed this fragment “table=paypal_ipn_orders&pos=0”. I’m not sure what pos means.

    I’m using PayMock as a test harness. If you would like to see the modified script, I could send you an email.

    Any assistance will be much appreciated.

  4. Jack Feng says:

    Hello Andrew,
    This method really fantastic !!! I have used it to debug my IPN listener page ! It work as my expect.
    I still have some understanding problems in PayPal IPN . My website accept PayPal account express checkout payment and credit card payment . When a customer shop online my website, and then finish payment in paypal , then customer close browser . My server will reiceives message from PayPay server , I will know the payment status , it maybe is “pending”,”completed” or “refunded” .If it is “pending”, I think it is no meaning for , Because I don’t have received any money from this customer pad.
    So, what is the function of the “pending” payment status.
    Thank you very much !

Leave a Reply