Webhook Guide

Stripe Webhook-Testguides

Payments and checkout event webhooks

Schnellpfad: CLI-Helper-Befehle

Use these first to avoid setup mistakes, then follow the full provider steps below.

instatunnel webhook init --provider stripe --port 4242 --path /webhooks/stripe
instatunnel webhook verify --provider stripe --secret-env STRIPE_WEBHOOK_SECRET
instatunnel webhook test --provider stripe

If you run into provider-specific issues, use the full checklist sections below.

For cross-provider MCP + webhook diagnostics, open /docs/troubleshooting.

Replay + Signatur-Helper (Dashboard)

Open /dashboard or /dashboard/tunnels and use Webhook Command Center for this provider. It gives one-click replay and signature verification helpers.

instatunnel webhook verify --provider stripe --secret-env STRIPE_WEBHOOK_SECRET
curl -i -X POST "https://YOUR-SUBDOMAIN.instatunnel.my/webhooks/stripe" -H "Content-Type: application/json" --data-binary @sample-stripe.json

Required signature header: stripe-signature

1. Lokales App-Setup

Create a local webhook endpoint at: /webhooks/stripe

import express from 'express'
import Stripe from 'stripe'

const app = express()
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!)

app.post('/webhooks/stripe', express.raw({ type: 'application/json' }), (req, res) => {
  const sig = req.header('stripe-signature') || ''
  try {
    const event = stripe.webhooks.constructEvent(
      req.body,
      sig,
      process.env.STRIPE_WEBHOOK_SECRET!
    )
    console.log('stripe event:', event.type)
    res.status(200).send('ok')
  } catch (err) {
    console.error('invalid signature', err)
    res.status(400).send('invalid signature')
  }
})

app.listen(3000, () => console.log('listening on :3000'))

2. InstaTunnel-Befehl ausfuhren

instatunnel 3000 --subdomain stripe-dev

Keep a fixed subdomain so your provider dashboard URL does not keep changing.

3. Provider-Felder zum Einfugen

FieldValueWhere/notes
Endpoint URL{{WEBHOOK_URL}}Stripe Dashboard > Developers > Webhooks
Events to sendcheckout.session.completed, payment_intent.succeededLimit to only what your app handles
Signing secretwhsec_...Copy from endpoint details and set STRIPE_WEBHOOK_SECRET
API versionLatest stableUse one version consistently in staging and prod

Use the helper below to generate exact values with your chosen subdomain and path.

Webhook-Setup-Helper mit einem Klick

Erzeugt Tunnel-Befehl, Webhook-URL und Provider-Werte zum Kopieren.

InstaTunnel starten

instatunnel 3000 --subdomain stripe-dev

Webhook-URL

https://stripe-dev.instatunnel.my/webhooks/stripe
Provider-FeldWert zum EinfugenHinweise
Endpoint URL
https://stripe-dev.instatunnel.my/webhooks/stripe
Stripe Dashboard > Developers > Webhooks
Events to send
checkout.session.completed, payment_intent.succeeded
Limit to only what your app handles
Signing secret
whsec_...
Copy from endpoint details and set STRIPE_WEBHOOK_SECRET
API version
Latest stable
Use one version consistently in staging and prod

Tipp: eine stabile Subdomain pro Provider nutzen, damit kein stndiges Umkonfigurieren notig ist.

4. Testevent senden

  1. Open Stripe Dashboard > Developers > Webhooks > your endpoint.
  2. Use "Send test webhook" for a handled event type.
  3. Confirm your local logs show the event and a 2xx response.
# Optional Stripe CLI flow
stripe listen --forward-to localhost:3000/webhooks/stripe
stripe trigger checkout.session.completed

5. Signatur prufen

Verify this header on every request: stripe-signature

// Stripe verifies with raw request body + endpoint secret
const event = stripe.webhooks.constructEvent(
  req.body,
  req.header('stripe-signature')!,
  process.env.STRIPE_WEBHOOK_SECRET!
)

6. Retries und Idempotenz

  • Store Stripe event IDs and ignore duplicates.
  • Return 2xx quickly, then process asynchronously.
  • If you return non-2xx, Stripe retries with backoff.

7. Haufige Fehler und schnelle Fixes

400 invalid signature

Use raw body middleware and confirm STRIPE_WEBHOOK_SECRET value.

Timed out endpoint

Acknowledge quickly with 200, move heavy work to a queue.

No events received

Check endpoint URL and selected events in Stripe dashboard.

Stripe Webhook-Testguides | InstaTunnel