Testing Instant Payment Notification

It is important to test IPN integration before "going live". The PayPal Sandbox provides an environment for testing without performing real payment transactions. It is also a good idea to test on the live PayPal system before putting a system into production.

Testing on the Sandbox
The PayPal Sandbox can be used to test most aspects of the PayPal system including Instant Payment Notification. To test on the sandbox:
  1. Establish a developer account on Developer Central http://developer.paypal.com
  2. Create a Personal account on the sandbox and add a credit card.
  3. Create a Business account on the sandbox and add and confirm a bank account.
  4. In your PayPal button and IPN handling script, use the URL https://www.sandbox.paypal.com/cgi-bin/webscr where you would normally use https://www.paypal.com/cgi-bin/webscr.
  5. Step through a payment using the Personal account email and password for log in.
A Note About Emails
In the PayPal API Sandbox, all of the participants in transactions (test users) are fictional and do not have true email accounts. To accommodate this, a special self-contained email system is integrated into the Sandbox. Each PayPal API developer has one inbox to which all email messages addressed to test users are sent. A developer only sees those emails addressed to test users linked to that developer. Emails to all test users linked to the developer appear in the same inbox. To view your Sandbox emails, Log in to Developer Central at https://developer.paypal.com and Click the 'Email' tab. Your Sandbox generated emails can be found on this page. For more information, please refer to the API Sandbox User Guide, pp 15-16.

Testing on the Live System
It is a good idea to test on the live system to make sure the switch to the live system doesn't introduce any problems. Some things to consider when testing on live:
  1. You will need access to a Personal account with a credit card linked and a verified Business account.
  2. Switch from the sandbox URL https://www.sandbox.paypal.com/cgi-bin/webscr to the live site URL https://www.paypal.com/cgi-bin/webscr.
  3. Pre-fund the Personal account to avoid incurring charges on the credit card.
  4. Test transactions can be as little as $0.01 USD.
  5. Payments may be refunded resulting in a full fee credit.
  6. It is good practice to log all IPNs received in a log file or database.