How to use 3 smart buttons for multiple items?

Ole7
New Community Member

Hello, my question is probably quite basic but I couldn´t find any help for many hours.
I want to sell 3 different products on a webpage using the new stylish smart buttons instead of the old "buy now" buttons.
But only the first smart button will be shown, all others will be ignored.
How can I setup different IDs for the three products?
I have changed div ID and render ID but it didn´t help 😞

<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=sb&amp;currency=EUR&amp;locale=de_DE" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'pill',
color: 'white',
layout: 'vertical',
label: 'paypal',

},
createOrder: function(data, actions) {
return actions.order.create({ purchase_units: [{ amount: { value: 97.00 } }], application_context: { shipping_preference: 'NO_SHIPPING'
}

});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');

</script>

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Hi @Ole7,

 

Thank you for contacting PayPal community.

 

We apologize for any inconvenience.

 

I request to initialize the script code only once in your code

<script src="https://www.paypal.com/sdk/js?client-id=sb&amp;currency=EUR&amp;locale=de_DE" data-sdk-integration-source="button-factory"></script>

 

Thank you for understanding and patience.

 

Sincerely,

Chiranjeevi

PayPal, Inc. 

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.