Skip to content
RecipesDoc

Stripe Webhooks End to End, Subscription Changes and Duplicate Events

Certyn changes a test subscription in Stripe test mode, checks the app and its UI follow, and checks that the same event sent twice applies once.

For teams whose app updates subscriptions from Stripe webhooks.

Your setup

  • A staging app with subscriptions in Stripe test mode.
  • Stripe test mode sends webhooks to the staging endpoint.
  • You want to know the app applies a subscription change, shows it, and does not apply the same event twice.

Say this to Certyn

On staging, test our Stripe webhooks end to end: when a subscription changes in Stripe test mode, the app must show the new plan, and the same event sent twice must count once.

What Certyn does

  1. Opens a secret form for STRIPE_SECRET_KEY (service stripe): the test secret key of the Stripe account staging uses. Opens the sign-in form if the test user is missing.
  2. Says the run length and starts a run (app.run.create type explore) with this goal.
  3. The run installs the Stripe CLI (it is not on the Machine by default), signs in, and subscribes in the browser with the test card 4242 4242 4242 4242. Now the subscription belongs to a user your app knows.
  4. Changes that subscription from the shell, for example to another price. Stripe sends the event to your endpoint. The run checks the plan in the UI and the subscription in Stripe.
  5. Sends the same event again with stripe events resend <event id> --webhook-endpoint <we_ id>, then checks nothing applied twice: no second credit, invoice, seat or email. With a DATABASE_URL secret, it also checks the rows.

What you get

  • A run report with each event id and what the app did with it.
  • One Certyn issue per real bug (a missed event, a double charge, a stale plan), with the event id and screenshots.
  • If you ask, an agent process with this goal on a schedule or after each deploy.

Limits

  • Stripe sends events from its servers to the endpoint in your Stripe settings, so staging must be reachable from the internet. Certyn does not set up Stripe.
  • For an app inside your network or on localhost: a runner Machine runs stripe listen --forward-to <your app's webhook URL>. Your app must then use the signing secret that stripe listen prints.
  • stripe trigger creates new customers your app does not know. It shows only that the endpoint accepts events, so Certyn uses the test user's own subscription.
  • Save only test keys. Never run this on production.