Test payments in WooCommerce with the PayPal Sandbox

Sandbox

You’ve created your WooCommerce store, uploaded all your products and are ready to accept payments via PayPal. But how can you know for certain if PayPal will work as expected with your store?

Most people will make a small purchase with a friend’s PayPal account as a live test. But that costs real money and is annoying if you have to test multiple times. This post explains how to test the payment system using the PayPal Sandbox.

The PayPal Sandbox is a place where you can test your shopping cart and other PayPal integrations in a realistic way, except that no money changes hands. This means you can test your PayPal processes in the Sandbox and know they will behave the same on the when you go live.

The PayPal Sandbox environment comprises the following:

You should take some time to read the official documentation.

How it all fits together

Here are the steps that this post will show you:

  1. Login to the PayPal developer website with your existing PayPal account
  2. Create Sandbox test accounts for the shop owner, and another one for a buyer
  3. Set the WooCommerce PayPal settings to the shop owner’s API details WooCommerce
  4. Make test purchases – without spending any real money

Login to the PayPal developer website

The first thing you need to do is to login to the PayPal developer website: http://developer.paypal.com

Login to PayPal Developer website

Click for larger image

Use your existing PayPal username and password to login. Once logged in you’ll arrive at the Dashboard. Navigate to Applications → Sandbox accounts (screenshot above).

Create Sandbox test accounts

Now we’ll need to create 2 test accounts – 1 for the merchant (representing your shop’s PayPal account) and 1 for a buyer (representing a customer).

Click the Create Account button to create an account.

Create test account

Click for larger image

You can make up an email address since no emails will ever be sent here. I like to use use merchant@whatever.com to remind me that it’s a merchant (business) account. It’s also useful to enter a name for the merchant account – this will appear on the make payment screen later.

PayPal’s documentation is pretty poor, so through trial and error and googling I found that passwords must contain symbols, numbers, upper-case characters. Also, I read that it’s best to have a starting balance of less than $1000.00.

Tip: I use $andb0xPa$$w0rd as the password, and repeat it for all Sandbox test accounts so I don’t need to remember multiple passwords.

Configure WooCommerce PayPal settings

Now go back to your WooCommerce store. Go to your WordPress dashboard → WooCommerce → Settings → Payment Gateways → PayPal. Configure it like the following:

WooCommerce PayPal settings

  1. Select checkbox: Enable PayPal standard
  2. Use the merchant test account email you created in Step 2 above for the PayPal & Receiver email
  3. Select checkbox: Enable PayPal sandbox

Save changes to save the settings.

Now the PayPal payment method is in test mode and will only accept test payments. Attempts to make payment with real PayPal accounts will result in payment failure. Keep in mind this only affects your PayPal payment method. If you have other payment gateways active (bank transfer, Authorize.net, etc) they will still accept real payments.

Make a test purchase

Now you can make a test purchase using the buyer test account. Using a different browser, visit your store and make a purchase. After you click the Place Order button, you will be sent to test store on the PayPal Sandbox to make your payment.

Test store on PayPal Sandbox

Click for larger image

You’ll know that it’s the test store because “test store” is visible in the store name and the URL is www.sandbox.paypal.com. PayPal may also add a Test Site label to the top or bottom of the page.

Login with the buyer test account and confirm the payment. Click the Return to merchant link to complete the order.

Congratulations! You’ve made a test payment with PayPal – without using any real money. Were there problems during the checkout process? Well you can make repeat test payments again and again till you solve the problem.

The Sandbox works almost exactly like the real PayPal site. One of the differences is that it doesn’t send any payment sent / received or error emails. To view those emails, you have to click on the notifications link for the appropriate account in the Sandbox Accounts page.

Sandbox notifications

Final notes

Remember that the payments are test payments. However, keep in mind that WooCommerce will still record them as orders in the system and will generate and send order confirmations, invoices, etc. Remember to delete these orders once you’re done testing.

And finally once you’re done testing, don’t forget to go to your WooCommerce settings to disable the sandbox and enter your real PayPal account details.

Happy testing!

About David

David has over 10 years of experience with web geekery and WordPress. That experience spans every­thing from cre­at­ing custom themes to opti­miz­ing WordPress sites for thou­sands of page views in a day. Follow David on Twitter at @blogjunkie and circle David on Google+.

Comments

  1. Documentation poor? I’ll say! I’ve wasted hours on it, and loads of other people have.

  2. Nice article. You’re right about the documentation on Paypal – it’s diabolical.

    Anyway, wonder if you could help. I followed everything you’ve done. My purchases go through ok, Sandbox Paypal notifications are there, the woocommerce order is fine, but no emails are sent to the test customer which is a real email address. Have tried multiple emails but they’re not sending.

    The emails send for my other two payment methods – BACS and cheque. Is there something I should look for in woocommerce or Paypal sandbox to make sure sales emails are sent?

    • With Sandbox transactions, all transactions including emails are simulated including the emails sent from PayPal. If you’re looking for the PayPal transaction emails they’ll be on the notifications page within the PayPal developer portal

      If you mean the WooCommerce order received / completed emails, those should be sent as usual. If they are not being sent, try a plugin like WP SMTP
      http://wordpress.org/plugins/wp-smtp/

      • Thanks for the reply David. I can’t see why the other payment methods would trigger emails to be sent to the customer but paypal in sandbox mode does not. The order is at processing mode which according to Woocommerce documentation is ‘Processing – Payment received and stock has been reduced- the order is awaiting fulfilment’

        I get the IPN notification from paypal notification so there is nothing wrong with the woocommerce setup. I shouldn’t need to add a plugin to send emails as they send perfectly well for the other payment methods. I’ll give it a crack though and see what happens….

    • Another plugin that’s useful is Email Log. That will report all the emails that are sent via WordPress

      http://wordpress.org/plugins/email-log/

      • David, this is amazing doc thank you very mach really… However my problem is same with Dave despite I already use the wp-smtp plug-in. All payment methods are fine to send woo-commerce email but the paypal mmmm no way. I’ve made a real payment with a real credit card but, nope. Do you have any idea to figure out how to get rid of that :)

  3. This works great on the regular paypal setting, but what about the Advanced extension? I enabled the sandbox option, but this plugin doesn’t use a simple email account. Do you know how I can get this working?

    Here is the settings page…
    http://pbrd.co/1apIPjf

    Here is what I get when I use our normal credentials…
    http://pbrd.co/1apIWLL
    http://pbrd.co/1apITzx

  4. Will do. The funny thing is that I asked them about how to test the checkout process and they sent me to this thread :)

  5. is there anyway to get the back to web site name rather than the merchant paypal email address during checkout process?

    • Hi Dylan, yes there is a setting somewhere which I used to change the name of my test store to “Max Merchant’s Test Store” in the example above. The setting is buried somewhere in the Sandbox settings at developer.paypal.com – good hunting!

  6. Hey David.
    I had sandbox enabled for a while when testing everything. Unwittingly, I kept it enabled and a couple of orders actually came through. They seemingly were processed by paypal and everything (however the funds are not showing in my paypal account) and I have just realized that the sandbox option has been checked this whole time :(

    Do you think the payments were ever really processed and they’re sitting out there somewhere in the ether or have I just stupidly lost money?

    • Yikes! Unfortunately you will not be receiving any payments for those transactions. You should contact your customers to say that there was a problem processing their payments and you need them to re-purchase / send their payment again..

  7. Dammit. Well, good to know for sure. Thanks for the response – and great article!

  8. I am still trying to get this resolved with Woo, but in the meantime maybe you have some advise. I have tried a few different combinations of username/password of the sandbox account in the Woo PayPal Advanced plugin but no luck. Take a look at these two screenshots and let me know what should go where…

    Woo plugin settings…
    http://pbrd.co/1eausA8

    Sandbox user settings…
    http://pbrd.co/1eauO9X

    Any help/advice would be appreciated :)

  9. I’ve used your method also and notice your screenshots u only get

    1) Paypal Login
    2) Create Pay Pal Account.

    Funny is you don’t get to pay directly with a credit card without a paypal account as per how it should work as a paypal standard.

    I’m scratching my head. Hope you have something

  10. Can’t believe just a few minutes after i posted here i found this website

    http://wphow.org/setup-paypal-to-accept-credit-cards/

    Apparently u need to go make paypal account optional in order to accept cc.

    Cheerios!

  11. Hi,

    I want paypal login on custom image .Dont want to display paypal’s standard button. So is it possible to use custom image for paypal login ??

  12. Thanks great staff

  13. After following your instructions on setting up the sandbox test store I tried testing it as a customer. Everything on the WooCommerce side seemed to work perfectly, but each time it’s rejected my ACTUAL PayPal email and password. I’m probably missing something, but I can’t for the life of me figure out what. I’ve tried it using 4 different browsers on 2 computers with no luck. Any help will be greatly appreciated.

    • Hi Doug, I’m not sure that you can / should use live (actual) PayPal info in sandbox mode. The sandbox should be for testing only. If you want to test with a live account you should configure the site with live merchant account details.

  14. I was pretty sure that was wrong, but I had been trying with the email and password set up in the PayPal Sandbox and have only ever gotten the prompt: “You are logging into the account of the seller for this purchase. Please change your login information and try again.” Change to what login information? All I’ve entered, as per your instructions, was the email I made up: merchant@sablephantom and the suggested password. And those won’t work as stated above. Thanks.

  15. hey, i just worked with this system… i’m able to pay as a buyer but there is no payment in the merchant’s paypal account on sandbox.
    “payment to” is there in the buyer’s account but the payment is unclaimed plus there is no “payment from” in the merchant’s account on sandbox.
    please help

  16. David, thanks you help me a lot.

  17. David, thank you so much for clearing up the messy fog of the paypal sandbox!!! I wouldn’t have wasted the time trying to figure it out without your guidance.

  18. thanks a lot

  19. David, THANK YOU! This was a life saver for me … made getting my store online so easy.

  20. beyondesign says:

    David, you sir are a gentleman and a scholar! Instead of burning through hours of trial and error setting up and testing, I can now focus on the things my clients will care about. I’m stoked I found your article. Thanks so much!

  21. Liz Hedstrom says:

    Thank you so much for this article!

  22. My problem seems similar to Kiri’s but I didn’t get a clear answer out of those comments. I had a sandbox account set up and some customers made real credit card payments through it. The payments show up in the sandbox business account but I haven’t asked the customers if their real credit card accounts lost balance. Would they lose balance and also is there a way to refund or transfer that money if they lost credit card balance?

    Thanks a lot in advance.

    • Hi Josh. Yes their payments would show up because the Sandbox simulates all transactions as accurately as possible. This means that your store will also think that the orders are “real” and cause it to reduce stock, send out confirmation emails, etc.

      On the buyer side though, they shouldn’t have been charged. Can you please check and report back and I’ll update my article. Thanks

  23. Hi,

    Thanks for the great info. I’m starting a digital download ecommerce site for a single product and I use the woocommerce plugin. Is there a way to avoid my customers having to enter any personal information on my site (e.g., name, address, etc) and complete the entire transaction on paypal? Thanks.

    • Hi Bob, this post isn’t the place to ask questions like this. You should post in the WordPress or WooCommerce support forums for advice. Good luck with your site.

  24. Thank you David. Your article here is absolute gold! Really helped me out.

  25. Kashif Muhammad Qasim says:

    Thanks a Trillion! You made my day :-)

  26. Thnks

  27. Hi David. Thanks for putting together such a well written post. Screenshots very helpful and enough text to be clear but still read quickly. It’s been very helpful.

  28. Hi David,
    This is a great tutorial, simple to follow..I am having a problem however as I can get no further than the WooCommerce Paypal settings page: it won’t accept the sandbox merchant email account? I have tried with 4 different email accounts (fake) that i have associated with Sandbox accounts. It will only accept my real business email that is linked to my real Paypal account. ???

  29. angelleye says:

    Nice, detailed article about testing with PayPal, which everybody needs to be doing prior to launching their website…especially developers of plugins, which unfortunately I find all too often doesn’t happen.

    I wound up developing my own PayPal extension for Woo which integrates Express Checkout and Payments Pro and makes the integrate with PayPal a lot more seamless than what comes with Woo by default (and improves greatly upon what Woo sells for EC and Pro.)

    Check it out, it’s free! http://wordpress.org/plugins/paypal-for-woocommerce/

  30. Hi there – great post, wish I’d found earlier ! I actually stumbled through and figured it out, but now am stuck on one issue: negative testing. I’d like to force an error situation, and have seen this lengthy explanation on sandbox https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions/
    but am at a loss as to how to implement it in woo commerce. Any ideas/tips?

    thnx!
    -jennyb

    • Hi Jenny, sorry but this article is about the extent of my knowledge of the PayPal sandbox. I think the best people to ask are the WooThemes ninjas. If you do get an answer please let us know. Thanks!

Trackbacks

  1. […] a great, straightforward article today on setting up Paypal Sandbox Testing on a WooCommerce wordpress […]