Playing In PayPal’s Sandbox

Hello, is this thing on?  Many of us who have, or are in the process of launching, e-commerce sites have wondered about this at one time or another.  The most common way of finding out is to make a test purchase of $1 or less, to see if everything works.  At about 35 cents a try (in PayPal fees), most people simply consider it a start up cost.  But there is an alternative, that costs nothing to use; the PayPal Sandbox.

With the sandbox you can simulate PayPal transactions, as many times as you want, without incurring any processing fees.  Not only can you simulate actual purchases, you can test drive your e-commerce site from the purchaser’s point of view.  You can even simulate how your site will react to purchasers with varying levels of PayPal funding and verification.

Getting Started

You will first need a PayPal sandbox account.  This account is separate from any of your primary or alternate PayPal accounts.  To get an account, visit the PayPal Sandbox site and Sign Up for Access to the Sandbox Test Environment.  Usually, when selecting an e-mail address for your sandbox account, you would normally not use an e-mail address associated with your site’s domain; for security reasons.  However, if you plan to conduct end-to-end testing that involves the sending of e-mail messages to customers, you might want to use a “hard to guess” e-mail address on your site’s domain, for the sandbox account.

Once you have completed the sign up and verification process, you should be able to log into your sandbox account.  Once logged in, you are at the sandbox “Home” page.  The two sections of the sandbox you will likely use the most are “Test Accounts” and “Test Email.”

Test Accounts

Test accounts are simulations of PayPal buyers and sellers.  Each test account has access to its own (simulated) PayPal account.  To properly test your site, you need to create 1 “Seller” and at least 1 “Buyer” test account.  To create test accounts, from the “Home” page of your sandbox account, select whether to “create a preconfigured account” or “create an account manually.”  It is recommended that you use preconfigured buyer & seller accounts, and then adjust them as needed.

After your test accounts have been created, you can goto the “Test Accounts” section of the sandbox, select an account, and then click “Enter Sandbox Test Site.”  Doing so will permit you to log into the simulated PayPal accounts of each test account; where you can perform most operations associated with real buyer and seller accounts.

Test Email

Whenever the “real” PayPal system processes transactions, it sends e-mail messages to the parties (buyer & seller accounts) involved.  The test accounts you create are assigned randomly suffixed e-mail addresses; with the same domain as your sandbox account.  The “Test Email” section of the sandbox will contain all e-mail messages that PayPal would normally try sending to real buyers and sellers.

This section (of the sandbox) however, will not capture any e-mail messages that your site might send to simulated buyers.  If you create a “paypaltest@yahoo.com” sandbox account, the sandbox will assign any test accounts it creates to the “yahoo.com” domain.  Any e-mail the sandbox tries to send to “sndbox_12345_per@yahoo.com” will be captured and saved in the “Test Email” section of the sandbox.  Any messages your site tries sending to that same (simulated Yahoo) e-mail address, will be sent to Yahoo and then bounced back to the (simulated) non-existent seller account (also at Yahoo).  Eventually, after enough bounces, the message becomes “lost in the bit bucket.”

To prevent this, and to test the sending of customer e-mails, you might consider creating a “catch all” e-mail account for your site domain.  Your sandbox account could be “secretpaypaltest@mysite.com” which causes any test accounts you create to be assigned to the “mysite.com” domain.  Using the “catch all” e-mail account, you could then test whether or not your site is properly sending all the messages it should be, to the buyer.

Configuring Your Site

Most e-commerce packages (such as WP eStore) that support PayPal, also support use of the PayPal Sandbox.  To setup your site, for sandbox testing, you only need to do 2 things; enable sandbox testing and specify your sandbox generated, seller test account, e-mail address.  Look for a setting (usually a check box) in your e-commerce software that says something like “enable sandbox mode.”  In the place where you specify your regular PayPal e-mail address, insert your seller test account a-mail address.  Save the settings  Now we are ready to play!

Let’s Play!

After configuring your software, if you immediately ran off, expecting everything to work… sorry.  In order for sandbox transactions to be properly processed, you must be logged into your sandbox account.  Here’s what you need to be doing…

Open 2 browser windows, or tabs; using the same browser session.  The first window is the “Test Conductor” window, and the second is the “Test Subject” window.  In the test conductor window, log into your PayPal Sandbox account.  In the test subject window, browse on over to your e-commerce site; and make sure that you are not logged in as the administrator.

In the test subject window, proceed to perform whatever test purchases or transactions you’d like.  Use the buyer test account e-mail address for all transactions.  Any PayPal generated e-mails will show up in the “Test Email” section of the sandbox; accessible from the test conductor window.  If you are using a “catch all” e-mail address (as earlier discussed), you will be able to read any e-mail messages generated by your site, as well.

Caveats And Warnings

  1. You must be logged into the sandbox, in order for test transactions to go through.
  2. Anyone trying to make “real purchases” while the site is configured for sandbox testing will be disappointed.  They will be presented with the PayPal Sandbox login page, when they try to checkout.
  3. Sandbox transactions are indistinguishable from real transactions.  Any sales, inventory or accounting records kept by your site will “think” that a real sale has occurred.  Remember to reset any inventory or sales records.
  4. Remember to undo the sandbox configuration changes to your site.
  5. If, while in sandbox mode, you setup any recurring (subscription) payments; remember to cancel them.  Otherwise months from now, when you are in non sandbox mode, your site will begin receiving invalid IPN from the sandbox; and your first reaction may be to think someone is hacking you.

About the Author: This post was written by TheAssurer who writes for Tips and Tricks HQ and helps out with plugin development.

Found this resource interesting? Subscribe to Tips and Tricks HQ

email icon rss feed icon twitter icon google plus icon

Comments (21 responses)

  1. Ugo says:

    Ouch Paypal just made it more difficult, now you need to setup the sandbox in a real paypal account, so we need to train our customers to teach them how to setup and use the sandbox…

    Since now I used to share the developer credentials, now its not possible anymore.

    bad bad bad :(

  2. Ivy says:

    @Stephen, Yes they can do the sandbox testing also. =)

  3. Stephen says:

    Can I get my client to set up his own sandbox account and the use that to pay a buyer in my sandbox account?
    I like to give my clients early access to my developments so that they can play with them. It would be helpful if they could simulate payments too at this stage.

  4. Chris L. says:

    PayPal’s Sandbox was unknown to me, so thanks for the information. I’ve been trying to test the “Thank you” page for a digital download purchase to make sure that the shortcode I put in the page will give the buyer the instant download link. However, since getting a token doesn’t seem available in the sandbox, I’m guessing that the sandbox doesn’t go that far for testing.
    I’ve gotten the token and everything set to go in my true PayPal account. But, my only PP account is my ‘sellers’ account, so if I try a real-time test purchase using this account, PayPal stops me when it notices I’m paying from the same account as the seller– I need to use a different account. @#$% :/ Oh well..such is life. Still, is there a way to test the ‘thank you’ page download link shortcode even under the circumstances?
    Thanks for all the terrific work.
    CPL

  5. Tcat says:

    Very nice article, and I must say, typical of your stuff… I’m getting the hang of this stuff quickly by your articles and plugins.

  6. admin says:

    You just use the sandbox URL to submit the payment data rather than the live PayPal URL. You should be able to look into your button code and change the PayPal URL to the sandbox URL.

  7. shlomo says:

    hello,
    What happens if you don’t have WP-shop on your websit eand you just made asimple buy now button. how do yuo make your store to be on “sandbox” mode?
    thanks,
    Shlomo

  8. admin says:

    @Andy, PayPal’s sandbox is the only way to do test purchases without doing live transactions. You can always suggest to PayPal to introduce another method of testing that doesn’t use sandbox.

  9. Andy Weil says:

    I don’t get it! There must be a simpler way to test buying and selling from pay pal.
    Is there a step by step method to show how to do this?

  10. Same problem like above comments and waste my half day on that.

  11. Bob says:

    Thanks for the good write-up. I am testing my wordpress site using the wp simple shopping cart against a Paypal sandbox I setup. When I select the checkout button on my site I am redirected to the Paypal payment site but the only option on this page is to either create a Paypal account or login to my paypal accout. I have purge all cookies from my machine, made sure I am logged into my Paypal sandbox account but Paypal will still not let the buy pay with a credit card unless they have a Paypal account. Any ideas on how to simulate paypal optional accounts on the sandbox. – Thanks

  12. i am very impressed about this service and very help me to my next project. In fact i did not know about this service before coming to this post.

  13. Lasse says:

    This was a really helpful tutorial on how to use the Sandbox, and I’m sure it would be a useful feature for people who do a lot of PayPal testing.

    Unfortunately for me, I’m the paranoid type and simply can’t get over the question “What if it works in Sandbox but not in real life?”

    Completely unreasonable, I know. But paranoia, I’ve heard, had never been based on reason.
    So I think, despite the Sandbox, I’ll continue to use my other email account to test PayPal—at least, for the meantime. But it still was a very good tutorial.

  14. Pendant says:

    I’ve been using the PayPal sandbox a couple of times when setting up e-commerce sites. It works well, but I think the interface and help could be better… I found it easy to get lost, especially when playing with the IPN stuff.

  15. Sounds interesting and very useful. Paypal is the only payment method which seems quite complex to implement. I actually never implemented it before. Think I’ll give it a go and open a Sandbox account.

  16. Ben says:

    Wow i didn’t know paypal had such option, this will really come in handy in the future.

  17. Richard says:

    Thanks for the article. I didn’t even know how to use paypal sandbox, but I can start playing around with it now.

  18. Jessica says:

    Nice article! Yeah it is really important to cancel the test subscriptions otherwise you keep getting the recurring payment notifications and get confused :)

  19. Dave says:

    @TheAssurer -

    Very nice article about the one place that many, who are trying to wrap their heads around e-commerce, fear to tread, yet must.

    Excellent tutorial.

  20. Peter says:

    Great article! I didn’t even know how to create a seller and a buyer account under the PayPal sandbox. I will able to do test transaction very easily now.

    Thanks

  21. James says:

    Wow! Very nice article, I am not so scared to use PayPal sandbox anymore :)

Speak Your Mind

*