Javascript SDK more than one button is showing.
Ade_35
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
May-20-2021
12:48 PM
I've created a Javascript SDK PayPal button to use on a checkout page. The amount value can be different every time.
The code seems to load fine on an HTML page with no other code:
<script src="https://www.paypal.com/sdk/js?client-id=XXXXXXXXXXXXX&components=buttons"></script>
<script>
paypal.Buttons({
style: {
layout: 'vertical',
color: 'gold',
shape: 'rect',
label: 'checkout'
}
}).render('#paypal-button-container');
</script>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
// Set up the transaction
return actions.order.create({
purchase_units: [{
amount: {
value: '1000.00'
}
}]
});
}
}).render('#paypal-button-container');
</script>
<div id = "paypal-button-container"></div>
I get the following when I load the HTML page:
All I want is one version of the 2 buttons, not 4.
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Change the button from Sandbox to Production in REST APIs
- Issue with Rendering Trustly Payment Button via PayPal JavaScript SDK in SDKs
- Enable Pay later without credit in SDKs
- Issue with Venmo Button Not Showing in Sandbox Environment
- PayPal subscribe button not showing up on mobile in Wordpress divi theme in PayPal Payments Standard