Working with the PayPal Sandbox

by Kyle on December 22, 2010

PayPal Sandbox

The PayPal sandbox is an invaluable test bed for anyone developing or working with a plugin or site that interfaces with PayPal. The sandbox provides you a method for executing complete transactions as if you were making a live purchase without actually spending any money. The sandbox is available to anyone with a developer account.

Step 1: Register

The first thing you are going to need to do is register for a developer account with PayPal. This is free and easy to do at http://developer.paypal.com

Step 2: Setup Your Accounts

Once you are registered and have logged into you new developer account you are going to need a couple of test accounts. You can’t use your actual PayPal accounts so what you need is to setup at least one Seller account and at least one buyer account. The easiest way to accomplish this is by using the “preconfigured” account option.

To set them up simply select Test Accounts on the left side menu of your developer control panel. Then select New Account: Preconfigured. Choose whether you would like to make it a buyer or a seller (you need one of each), give it an e-mail address and set your password.

*A note on e-mail addresses: The email address you setup for your test accounts is 100% fakity Fake. It cannot receive external e-mail. That means if you use the “buyer” account to make a purchase and the application you are testing sends out something, like a gift certificate, via e-mail you are never going to get it. When I am testing I don’t “login” with a test account to make my purchases I just use the buyer accounts credit card information and then I can make sure they use a REAL e-mail address for the interface with my app.

Step 3: Configuring Your Plugin/App

Now that you have your test accounts setup you need to configure your plugin / app to make sure it is pointing at your development environment. The PayPal url for test transactions needs to be set to http://www.sandbox.paypal.com/cgi-bin/webscr.

You also need to ensure you set the Business e-Mail to the SELLER account you setup in the developer control panel, not your actual PayPal ID or event he ID you use to login to developer.paypal.com. This is one of the mistakes I see people making, the Sandbox is potentially going to allow you to do the transaction but the results are not going to be what you want.

Step 4: Test, Test, and Re-test

Now that you have everything configured it is time to start your testing. You can now freely create transactions in your shopping cart or other PayPal enhanced plugin without having to actually do live transactions where money changes hands. A couple of things should still be kept in mind:

  1. Any PayPal generated e-mail messages that would typically be sent to the buyer/seller are not going to be sent out, you can only find them by accessing the developer panel and going to the “Test Email” section.
  2. Just because it worked in the SandBox doesn’t mean it will work in production (so test at least one transaction on the live system).
  3. Make sure you test all of your possible scenarios, and be prepared for people who are having problems with your setup. It is just inevitable.

That is the quick and dirty of it, I will be adding a follow up post on using IPN and how to test effectively using the SandBox. Got questions? Drop me a comment and I will try my best to help you out.

Comments on this entry are closed.

Previous post:

Next post: