Webhook Guide

Stripe Guides de test webhook

Payments and checkout event webhooks

Chemin rapide : commandes helper CLI

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 + helper signature (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. Setup app locale

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. Lancer InstaTunnel

instatunnel 3000 --subdomain stripe-dev

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

3. Champs provider a coller

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.

Assistant setup webhook en un clic

Genere commande tunnel, URL webhook et valeurs provider pretes a coller.

Lancer InstaTunnel

instatunnel 3000 --subdomain stripe-dev

URL webhook

https://stripe-dev.instatunnel.my/webhooks/stripe
Champ providerValeur a collerNotes
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

Astuce : gardez un sous-domaine stable par provider pour eviter la reconfiguration.

4. Envoyer un evenement de test

  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. Verifier la signature

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. Retrys et idempotence

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

7. Echecs courants et corrections rapides

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 Guides de test webhook | InstaTunnel