Magento PayPal Sandbox Tutorial

How to set up a PayPal sandbox account for your Magento store

You can check and test the process of making and accepting orders on your Magento store by setting up a test (Sandbox) PayPal account. All the transactions completed through this account are fake, meaning they are just for testing and don't involve any real money.

First you have to create a PayPal Sandbox account in the developer section of PayPal's site. Click on the button Sign Up Now to begin the process. Fill out the form and click on Agree and Submit:

PayPal Sandbox Sign Up Form

After you submit the registration form you'll receive an email containing the instructions for logging in to your account. So open your email and read the email message. The email contains a link which you have to open and then re-enter your login information. After you do this you'll be logged in to your new PayPal Sandbox account:

PayPal Sandbox Account Home Page

The next thing you should do is to create two preconfigured test accounts: one for buyer (personal) and one for seller (business). To do this, click on the link preconfigured account on the home page of your PayPal Sandbox account. Don't forget to add some money to the account balance of the buyer. This is done on the Create a Sandbox Test Account page (after you click on preconfigured account). The money is not real, of course, it's for testing only. Also make sure that you copy the passwords for the two accounts.

From your PayPal Sandbox account you can also get test API credentials which you can copy in the options of your site's admin panel (System>Configuration>PayPal>API/Integration Settings panel). You'll need them if you want to test the Express Checkout payment method or Website Payments Pro. In our example we'll test the Website Payments Standard and we'll just use the two test accounts (seller and buyer). To set the Website Payments Standard options for our store, we log in to the admin panel and go to System>Configuration and from the Sales section on the left we click on PayPal. Then we make sure that the checkbox for the Website Payments Standard is marked and from the panel with the options for that payment method we set the Sandbox Mode option to Yes:

Magento PayPal Options

After you create a PayPal Sandbox account and add a test seller and buyer in it, and after you configure the options on the backend (admin panel) of your site, the next thing you can do is to turn on the Instant Payment Notification (IPN). With IPN enabled PayPal will send payment messages to the admin panel of your Magento store. To enable IPN, log in to your PayPal Sandbox account, click on Test Accounts. You'll see a table with the two test accounts (seller/business and buyer/personal). Mark the button for the business account and click on the button Enter Sandbox Test Account. It's right under the table. You'll be redirected to the login page for the seller account. Type the password for the seller account to log in.

Inside the account click on Profile and then click on Instant Payment Notification Preferences (it's in the Seller Preferences column). After that click on the button Choose IPN Settings and on the new screen mark the button Receive IPN messages (Enabled). In the field for Notification URL type the following URL: http://yourstore.com/paypal/ipn/ (change yourstore.com with the actual hostname of your store):

IPN Settings For Test Business Account

The example URL structure is valid, of course, if you have installed Magento in the root (public_html) directory on your account. Don't forget to click on the Save button.

Another useful option that you can turn on from your test PayPal business account is the Auto Return for Website Payments. It brings your customers back to your site after completing the payment on PayPal's site. It doesn't apply to all the payment methods. To enable it, log in to your PayPal business account, click on Profiles, in the Selling Preferences column click on Website Payment Preferences. Then set the Auto Return option to On and type the return URL (e.g. http://yourstore.com/paypal/success):

Auto Return Settings For Test Business Account

Don't forget to click on the Save button at the bottom of the page.

After you've created the test accounts, you can go to your Magento store and make a test transaction. Use the test PayPal buyer account to order something from your store. You also have to be logged in your PayPal Sandbox account before you start the transactions. If you click on Test Accounts in your Sandbox account, and then click on View Details for the personal/buyer account, you can see the example credit card information. From the Sandbox account you can also log in to the buyer account itself, and there if you click on Profile you can view the example account and financial information.