darth_morgan Posted October 26, 2021 Share Posted October 26, 2021 (edited) 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! Edited October 26, 2021 by darth_morgan Link to comment
tuanphan Posted October 27, 2021 Share Posted October 27, 2021 Hi, Duplicated, change div & remove script code from Code Block 2+ Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
mccartio Posted December 8, 2021 Share Posted December 8, 2021 I am having the same issue and could use some more detail on tuanphan's answer. Are you saying to simply change the DIV id? Thanks for any clarification. Link to comment
tuanphan Posted December 12, 2021 Share Posted December 12, 2021 On 12/9/2021 at 1:28 AM, mccartio said: I am having the same issue and could use some more detail on tuanphan's answer. Are you saying to simply change the DIV id? Thanks for any clarification. I meant try remove this line from Code Block 2 <script src="https://www.paypal.com/sdk/js?client-id=AVK6OAb9FUfrk9nOyAnPy5SKpT-jtF9yGVAXqaDjpONPYhQbUspycoO3XvsLq0V-GQnzr11Vu9Rr3MUV&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment