After the user clicks the purchase button we need to do the following:
- Send an XHR request from the client to the server requesting the publishable key
- Respond with the key
- Use the key to create a new instance of Stripe.js
- Send another XHR request to the server requesting a new Checkout Session ID
- Generate a new Checkout Session and send back the ID
- Redirect to the checkout page for the user to finish their purchase
- Redirect to a success page after a successful payment
- Redirect to a cancellation page after a cancelled payment
- Set up the webhook endpoint
- Test the endpoint using the Stripe CLI
- Register the endpoint with Stripe
for detail tutorial follow the below link [https://testdriven.io/blog/django-stripe-tutorial/]