Webhook

Understand the Stripe webhook events handled by the boilerplate.

Webhook Events

The following Stripe events are automatically handled:

EventAction
checkout.session.completedAttach customer ID, grant trial credits or purchase credits
customer.subscription.updatedUpsert subscription, update user plan
customer.subscription.deletedUpsert subscription, update user plan (downgrade to Free)
invoice.payment_succeededGrant renewal credits to user

Local Development

Follow the instructions on the Stripe CLI page to install it.

The Stripe CLI is needed to receive webhook events during local development.

Run the webhook listener:

pnpm stripe

Copy the webhook signing secret from the terminal output and paste it beside STRIPE_WEBHOOK_SECRET in the .env file.

.env
STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret
Keep the webhook listener running while developing locally.