Join our community

Get access to the complete guide to developing and deploying fast, production-ready Nuxt apps.

7-12 Verify Purchase with Stripe Webhooks

In this lesson, we create our Stripe webhook handler.

We first create a generic method to handle any event we receive from Stripe. This requires verifying that the request came from Stripe using a signature that Stripe gives us.

Then, we can handle each event type in its own method handler. We handle the payment success and payment failed types. This lets us update the CoursePurchase object to set it as verified or delete it if the payment fails.

Stripe webhooks: https://stripe.com/docs/webhooks