Integration of Django-PayPal subscription based payment system

I am trying to implement a Subscription-based payment method in Django. I have tried to Integrate the subscription-based button as per the PayPal guidlines. Screenshot is attached for same.

Subscription-based button

But after clicking on either button screen is blank, and nothing happens, screenshot is attached for the same.

enter image description here

Here is my code for button integration.

<div id="paypal-button-container-P-789654"></div>
<script src="https://www.paypal.com/sdk/js?client-id=123456&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-789654'
        });
      },
      onApprove: function(data, actions) {
        alert(data.subscriptionID); // You can add optional success message for the subscriber here
      }
  }).render('#paypal-button-container-P-789654'); // Renders the PayPal button
</script>
Back to Top