Jump to content

Adding code to payment page for subscription button.


MJPMalc
 Share

Recommended Posts

Hello,

 

Where do i add this code to add an extra button to payment page for subscription.  Thanks

<div id="paypal-button-container-P-5WH16516Y1333711AL6IXKLY"></div>
<script src="https://www.paypal.com/sdk/js?client-id=ARqekNCFqN5PrJW4WCEvIh7jqw2XRiLthPgZi0WePZG_dGXTcOHw-dvJgDVcirqhmprQZVQlXJNoBNyg&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script> 
<script>
  paypal.Buttons({
      style: {
          shape: 'rect',
          color: 'white',
          layout: 'vertical',
          label: 'subscribe'
      },
      createSubscription: function(data, actions) {
        return actions.subscription.create({
          /* Creates the subscription */
          plan_id: 'P-5WH16516Y1333711AL6IXKLY'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-5WH16516Y1333711AL6IXKLY'); // Renders the PayPal button
</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...