Jump to content

Adding code to payment page for subscription button.


MJPMalc

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...