Webhooks: payment status is decided on the server
Relying on the thank-you page to activate a subscription means granting access to people who do not pay, or refusing it to people who did. This lesson teaches you to have the agent build the function that receives Stripe webhooks and keeps subscription status up to date in the database, then to test it on the cases that matter, with or without the Stripe CLI.
Lesson objective
By the end of this lesson, you will be able to have a server function built that receives Stripe webhooks, verifies their signature, ignores duplicates and keeps the subscription status up to date in the database, then test it (payment, duplicate, cancellation through the customer portal) with the Stripe dashboard or the Stripe CLI.
Topics covered
- Stripe webhooks
- subscription status
- Stripe CLI
- idempotency
- server-side payments
In the glossary
Where it fits
Take a Stripe payment, in test mode
How do I charge for a subscription, and know for sure who has paid?
Lessons in this module
- Open a Stripe Checkout payment from the server
- Webhooks: payment status is decided on the server (this lesson)
What you will learn in this module
This lesson is part of the course Add a database, authentication and payments to your app
- Integrate Stripe Checkout in test mode (product, price, session created on the server, test cards) without exposing the secret key.
- Hold payment status on the server with signed, deduplicated Stripe webhooks, tested with the Stripe CLI or the Dashboard.
Related courses
- AI & DevelopmentJuniorSome basics are useful: introductory knowledge of the topic.
Build and ship a web app with an AI coding agent
2 hr 45 min
- AI & DevelopmentAdvancedRegular practice: you already use the tools or work on this topic.
Work with Claude Code on a real project: context, planning, review
3 hr
- Product ManagementAdvancedRegular practice: you already use the tools or work on this topic.
Git for PMs: ship as a team without putting production at risk
3 hr 30 min