How to switch PayPal Smart Button between Sandbox mode and Live mode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just created an "app" and received a client ID for both sandbox and live modes.
When I use the examples here: https://developer.paypal.com/docs/checkout/integrate
They work with the live client ID but not the sandbox ID.
With the sandbox ID, the popup window quickly appears then disappears. In the Javascript console I see an error saying "Invalid client ID":
How do I make the button accept my sandbox client ID?
- Labels:
-
Carts
-
Express Checkout
-
SDK

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to modify the "SRC" line of the sample code and change the URL to reflect you're submitting the transactions to our sandbox environment.
src="https://www.paypal.com/sdk/js?client-id=CLIENT_ID">
src="https://www.sandbox.paypal.com/sdk/js?client-id=SB_CLIENT_ID">
Thanks !
Was my post helpful? If so, please give me a kudos!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the response @MTS_Justin!
Unfortunately, I'd already tried this and it gives me a 400 (bad request) error. I checked the contents returned and it shows as:
throw new Error('SDK Validation error: Do not integrate with sandbox domain'); /* Original Error: Do not integrate with sandbox domain (debug id: ba18a7afc48af) */
Any ideas?
I double and triple checked the URL and also made sure I'm using my sandbox client ID

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start with this code - Place it on a page on it's own, replace "sb" with your sandbox client_id. Let me know if it works.
<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>
<script>paypal.Buttons().render('body');</script>
Thanks !
Was my post helpful? If so, please give me a kudos!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That worked - I then changed my original code to use "www.paypal.com" rather than "www.sandbox.paypal.com", and that also worked.
Which is weird because I could have sworn that was the first thing I tried - since that's what's in the documentation.
Everything seems to be working now, thanks!

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Sandbox account collect billing and shipping address in Sandbox Environment
- "System error. Please try again later" when connecting to paypal sandbox account with my android app in Sandbox Environment
- Things don’t appear to be working at the moment in PayPal Payments Standard
- Something went wrong. Contact the merchant for help. in PayPal Payments Standard
- NOT ENABLED TO VAULT PAYMENT SOURCE in Sandbox Environment