Next.js App Router

Learn how to build a SaaS with Next.js App Router and Supabase

Stripe Payments

In this lesson, we learn how to implement payments using Stripe and let users subscribe to a plan using Stripe Checkout.

Reading Time: 62 minutes

If you are building a SaaS, you probably want to charge your users so they can use your service. In this module, we hook up our application with Stripe Checkout, a hosted payment gateway that helps accept payments from customers.

Since Stripe does a lot of the heavy lifting thanks to Stripe Checkout, our application's responsibility is mainly to respond to the events sent from Stripe and update our database to keep data in sync.

The process is fairly simple:

  1. Checkout: Users will choose a plan in the application, and we will redirect them to the checkout. We will identify users in Stripe by using their IDs
  2. Webhooks: Webhooks are events sent by Stripe to our servers. These eve ...