I'd like to use the below paypal code in a multiple spots on the one page, but they seem to cancel each other out. When I view the live page, only one instance of the code works.
How can I use the same code several times on one page without it cancelling itself out? I've tried changing the div id for each instance.
<div id="paypal-button-container-P-0N639951XH242245SMFZ55JI"></div> <script src="https://www.paypal.com/sdk/js?client-id=AVK6OAb9FUfrk9nOyAnPy5SKpT-jtF9yGVAXqaDjpONPYhQbUspycoO3XvsLq0V-GQnzr11Vu9Rr3MUV&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script> <script> paypal.Buttons({ style: { shape: 'pill', color: 'blue', layout: 'vertical', label: 'subscribe' }, createSubscription: function(data, actions) { return actions.subscription.create({ /* Creates the subscription */ plan_id: 'P-0N639951XH242245SMFZ55JI' }); }, onApprove: function(data, actions) { alert(data.subscriptionID); // You can add optional success message for the subscriber here } }).render('#paypal-button-container-P-0N639951XH242245SMFZ55JI'); // Renders the PayPal button </script>
Thanks!