Skip to content
Module
Module 5 of 6Lesson 2 of 2~28 min

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

Full 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

  1. Open a Stripe Checkout payment from the server
  2. 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.