In this lesson, we’ll go over how we’ll grant access to our online course.
We have two problems to solve:
- Securely verifying the purchase through the backend
- Linking the user’s Github account with the purchase
We’ll solve this using a CoursePurchase object:
- Create the CoursePurchase when we create the PaymentIntent
- Wait for Stripe’s webhook to verify the purchase was successful
- Redirect the user to login, so we can link their Github with the CoursePurchase account
To grant access, we then look up this CoursePurchase object in our middleware to verify the user has paid for the course.