Paypal smart button (multiple buttons)

glcvr6
Contributor
Contributor

Hello guys,

I am wondering is it possible to show/use multiple Smart buttons on website side by side?

 

I am trying to find a way but not so lucky so asking here.

 

I am using this code generated automaticaly:

	<div id="paypal-button-container"></div>
<!-- <script src="https://www.paypal.com/sdk/js?client-id=sb&currency=EUR" data-sdk-integration-source="button-factory"></script> -->
<script src="https://www.paypal.com/sdk/js?client-id=ARcbGj17hMo1yw4nEMDB5E-Y7W00gbie9F_zb0m--XCOjKWo4jIddFV9N5UzbluK-if61HLUVs0rQ7zC&currency=EUR" data-sdk-integration-source="button-factory"></script>
<script>
  paypal.Buttons({
      style: {
          shape: 'pill',
          color: 'gold',
          layout: 'vertical',
          label: 'buynow',
          
      },
      createOrder: function(data, actions) {
          return actions.order.create({
              purchase_units: [{
                  amount: {
                      value: '13.88'
                  }
              }]
          });
      },
      onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
              alert('Transaction completed by ' + details.payer.name.given_name + '!');
			  window.open('www.google.ba');
          });
      }
  }).render('#paypal-button-container');
</script>

I have tried to change class of button : render('paypal-button-container'); to anything else like 'paypal' and then changing <div> class where it should show but nothing happens.

 

Is is even possible?

Login to Me Too
1 REPLY 1

MTS_Andre
Moderator
Moderator

Hi Glcvr6, if you want to render more than one button you could just load the sdk once (<script src="https://www.paypal.com/sdk/js?client-id=... ... ...) and then call paypal.Buttons({ .. }).render() multiple times.

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.