Webhook
Understand the Stripe webhook events handled by the boilerplate.
Webhook Events
The following Stripe events are automatically handled:
| Event | Action |
|---|---|
checkout.session.completed | Attach customer ID, grant trial credits or purchase credits |
customer.subscription.updated | Upsert subscription, update user plan |
customer.subscription.deleted | Upsert subscription, update user plan (downgrade to Free) |
invoice.payment_succeeded | Grant 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 stripeCopy the webhook signing secret from the terminal output and paste it beside STRIPE_WEBHOOK_SECRET in the .env file.
STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secretKeep the webhook listener running while developing locally.