stripe-webhook-setup
/stripe-webhook-setup
Set up or fix a Stripe webhook endpoint correctly - raw-body signature verification, idempotent processing, out-of-order events, fulfilment from webhooks, and local testing with the Stripe CLI. Works for Next.js, Express, Cloudflare Workers, Firebase Functions, Supabase Edge Functions and Python. Use when the user adds payments or subscriptions, says "payment succeeded but nothing happened", or sees webhook signature errors.
- Author
- blitzhash360-web ↗
- Repository
- blitzhash-vibe-coding-rules ↗
- Licence
- MIT
- Last repository change
- 09.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 09.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Set up or fix a Stripe webhook endpoint correctly - raw-body signature verification, idempotent processing, out-of-order events, fulfilment from webhooks, and local testing with the Stripe CLI. Works for Next.js, Express, Cloudflare Workers, Firebase Functions, Supabase Edge Functions and Python. Use when the user adds payments or subscriptions, says "payment succeeded but nothing happened", or sees webhook signature errors.
Triggers from the description
Original author description
Set up or fix a Stripe webhook endpoint correctly - raw-body signature verification, idempotent processing, out-of-order events, fulfilment from webhooks, and local testing with the Stripe CLI. Works for Next.js, Express, Cloudflare Workers, Firebase Functions, Supabase Edge Functions and Python. Use when the user adds payments or subscriptions, says "payment succeeded but nothing happened", or sees webhook signature errors.
How it works
- When to use
- Steps
- Output format
- Safety rules (always)
SKILL.md preview
---
name: stripe-webhook-setup
description: Set up or fix a Stripe webhook endpoint correctly - raw-body signature verification, idempotent processing, out-of-order events, fulfilment from webhooks, and local testing with the Stripe CLI. Works for Next.js, Express, Cloudflare Workers, Firebase Functions, Supabase Edge Functions and Python. Use when the user adds payments or subscriptions, says "payment succeeded but nothing happened", or sees webhook signature errors.
license: MIT
metadata:
origin: BlitzHash
pack: blitzhash-vibe-coding-rules
---
# Stripe webhook setup
The success page is not proof of payment. The verified webhook is.
## When to use
- Adding Stripe Checkout, subscriptions or one-off payments.
- "No signatures found matching the expected signature" errors.
- Paid users not getting access, or users getting access twice.
## Steps
1. **Find the runtime** (Node server, Next.js App Router, Express, edge runtime, Python) and the existing Stripe client. Confirm `STRIPE_SECRET_KEY` and `STRIPE_WEBHOOK_SECRET` come from env vars on the server only.
2. **Get the raw body.** Next.js App Router: `await req.text()`. Express: `express.raw({ type: "application/json" })` on this route only, registered before `express.json()`. Firebase Functions: `req.rawBody`. Python frameworks: the raw request bytes.
3. **Verify the signature.** `stripe.webhooks.constructEvent(raw, sig, secret)` in Node; `await stripe.webhooks.constructEventAsync(raw, sig, secret, undefined, Stripe.createSubtleCryptoProvider())` on edge runtimes; `stripe.Webhook.construct_event` in Python. Bad signature returns 400 and stops.
4. **Make it idempotent.** Create a `processed_events` table (or collection) with `event_id` as a unique key. Skip events already stored; store after successful processing.
5. **Handle only the events you need**, typically `checkout.session.completed`, `invoice.paid`, `invoice.payment_failed`, `customer.subscription.updated` and `customer.subscription.deleted`. For subscription state, re-fetch the subscription from the API rather than trusting event order.
6. **Fulfil here, not on the success page.** Grant access, credits or plan changes in the webhook handler. The success page only shows status by reading your database.
7. **Respond fast.** Return 200 once recorded; push slow work (emails, PDFs) to a queue.
8. **Test locally:** `stripe listen --forward-to localhost:3000/api/webhooks/stripe`, put the printed `whsec_...` value in your local `.env`, then `stripe trigger checkout.session.completed`. Send the same event twice and confirm it is processed once.
9. **Production:** create the endpoint in the Stripe Dashboard with only the needed events, put its signing secret in the hosting env, and check the Dashboard's webhook delivery log after the first live payment.
## Output format
The webhook handler, the idempotency table or migration, the list of subscribed events, and the local test commands.
## Safety rules (always)
1. Use test-mode keys while building. Never switch to live keys or create live webhook endpoints without the user's explicit "yes".
2. Never print, log or commit `sk_live`, `rk_live` or `whsec` values. Use placeholders such as `whsec_REPLACE_ME` in docs.
3. Never issue refunds, cancel subscriptions or change prices from code you are testing.
Versions
The database has no other skills named stripe-webhook-setup.
Database snapshot: 13.11.2026 · package version 1c1631b600f7 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95stripe-payments
Use this skill when the user says 'stripe subscription', 'stripe webhook', 'subscription lifecycle', 'stripe billing', 'invoice.paid', 'past_due', 'dunning', 'stripe idempotency key', 'constructEvent'. It designs Stripe Billing subscription flows and production-grade webhook… - 100webhook-integration
Dodo Payments webhook handling, covering endpoint setup, Standard Webhooks signature verification on the raw body, payment, subscription, and refund event types, idempotency with webhook-id, retries, and local testing. Use when receiving Dodo events, verifying webhook-signature… - 100stripe-webhooks
Receive and verify Stripe webhooks. Use when setting up Stripe webhook handlers, debugging signature verification, or handling payment events like payment_intent.succeeded, customer.subscription.created, or invoice.paid. - 100stripe-webhook-security
Check and fix a Stripe webhook endpoint. Scans for handlers that act on Stripe events without `constructEvent` signature verification and for signatures checked against a parsed body (`req.json()`, `JSON.stringify`, `express.json()`, a pages/api route with the default body… - 100stripe-test-cards-and-webhooks
Use for any question or task about testing Stripe payments, including one webhook handler and checkout that fails for 3D Secure cards: test-mode keys, test cards for success, declines and 3D Secure, stripe listen to forward webhooks locally, stripe trigger fixtures, and… - 100stripe-integration
Implements Stripe payments, subscriptions, and webhooks so billing state stays correct - Checkout Sessions, signature-verified idempotent webhook handlers, dunning, and SCA handling. Use when someone asks "add Stripe subscriptions to my app", "why is my webhook signature…