cancel
Showing results for 
Search instead for 
Did you mean: 

How to switch PayPal Smart Button between Sandbox mode and Live mode?

Options
inversehessian
Contributor
Posted on

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":

 

Screen Shot 2019-05-13 at 12.02.29 AM.png

 

How do I make the button accept my sandbox client ID?

4 REPLIES 4

How to switch PayPal Smart Button between Sandbox mode and Live mode?

Options
MTS_Justin
Moderator
Hello,

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!

How to switch PayPal Smart Button between Sandbox mode and Live mode?

Options
inversehessian
Contributor

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

How to switch PayPal Smart Button between Sandbox mode and Live mode?

Options
MTS_Justin
Moderator
Hello,

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!

How to switch PayPal Smart Button between Sandbox mode and Live mode?

Options
inversehessian
Contributor

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.