PayPal button invoke Sandbox mode only, and cant pay with real personal account
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I was able to get a PayPal button to work and invoke a piece of my code on my Wix website. I use HTML element to embed the code on the page.
I was only able to pay in sandbox mode, while using the generated sandbox accounts PayPal generates, and not other real personal accounts.
I followed the guide found here: https://developer.paypal.com/docs/checkout/integrate/# in order to create the button and payment.
When it came to run live, I switched the client ID to the live one but couldnt find where to change any API calls from https://api.sandbox.paypal.com to https://api.paypal.com.
After I put in the live client-ID the sandbox pay window still gets invoked.
How can I get the live version to work and be able to accept payment from non sandbox accounts?
TIA,
the code I use:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Ensures optimal rendering on mobile devices. -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Optimal Internet Explorer compatibility -->
</head>
<body>
<script
//sandbox
src="https://www.paypal.com/sdk/js?client-id=AQpXvDkj1yqBNBC-SGiF3IdEvuQwN4AzEsusy1vr1rxIVfD-UpsHNcXC2gOzqoEnnSN3Q-5q80zpVtLg"> // Required. Replace SB_CLIENT_ID with your sandbox client ID.
//live
//src="https://www.paypal.com/sdk/js?client-id=<Live client ID from Dashboard>">
</script>
<div id="paypal-button-container"></div>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
}
}]
});
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
window.parent.postMessage(" ", "https://wpcjerusalem.wixsite.com/wpcjerusalem/register-for-rental");
});
}
}).render('#paypal-button-container');
</script>
</body>

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
- NOT ENABLED TO VAULT PAYMENT SOURCE in Sandbox Environment
- Cannot create developer account from invitation link in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Not receiving any confirmation emails for sandbox account in Sandbox Environment