Test Stripe Webhooks Locally
Option 1: Stripe CLI (fastest for development)
For day-to-day development, the Stripe CLI is the quickest path:
stripe listen --forward-to localhost:3000/api/webhooks/stripe
The CLI prints a webhook signing secret (whsec_...) for verifying events locally. No public URL required.
Option 2: LocalToLink (full HTTPS URL testing)
Use a tunnel when you need to test with the real Stripe Dashboard webhook endpoint — for example, verifying your production-like URL format or testing with Stripe's "Send test webhook" button.
# Terminal 1
npm run dev
# Terminal 2
npx localtolink --port 3000
Register in Stripe Dashboard → Developers → Webhooks:
https://YOUR-SUBDOMAIN.localtolink.com/api/webhooks/stripe
Replace YOUR-SUBDOMAIN with the 10-character subdomain LocalToLink assigns.
Verify webhook signatures
Your handler must verify Stripe signatures regardless of approach:
const event = stripe.webhooks.constructEvent(
req.body,
req.headers["stripe-signature"],
process.env.STRIPE_WEBHOOK_SECRET
);
With Stripe CLI, use the whsec_ secret from stripe listen. With Dashboard webhooks, use the signing secret from the endpoint configuration.
Important notes
- Webhook POST requests are server-to-server — they bypass LocalToLink's browser interstitial
- Session limit: 2 hours — restart the tunnel if testing longer sessions
- LocalToLink does not replay or inspect requests — check Stripe Dashboard → Events for delivery logs
- No custom subdomain in v1.0 — update the Dashboard URL when you start a new session
Related
- Test Webhooks Locally — hub for all providers
- Expose Localhost to the Internet — tunnel basics
Try it now
Start a tunnel from your project directory — no account required.
$ npx localtolink