Stripe webhook · Stripe CLI
stripe listen forwarding problems (local)
[ERROR] Failed to POST: Post "http://localhost:3000/api/webhook": dial tcp [::1]:3000: connect: connection refusedWhat it means
The CLI receives events and forwards them to a local URL. It fails if the dev server isn't running, the port or path is wrong, or your app uses a different secret than the one stripe listen printed.
Common causes
- next dev isn't running, or runs on another port
- Wrong path in --forward-to
- localhost resolves to IPv6 ::1 while the server listens on IPv4
- STRIPE_WEBHOOK_SECRET is the Dashboard secret, not the CLI one
How to fix it
- Start next dev first, then stripe listen --forward-to localhost:3000/api/stripe/webhook
- Copy the whsec_ it prints into .env.local and restart next dev
- Try 127.0.0.1 instead of localhost if you see [::1] connection refused
- Fire a test with stripe trigger checkout.session.completed
npm run dev
stripe listen --forward-to localhost:3000/api/stripe/webhook
# copy the printed whsec_... into .env.local, restart dev
stripe trigger checkout.session.completedstripe listen --forward-to localhost:3000/api/stripe/webhook
stripe listen --print-secret # the whsec_ to put in .env.local
stripe trigger checkout.session.completed
pass if stripe listen prints [200] for every forwarded event, not 400 or 500.
Prompt for Cursor or Claude Code
Set up local Stripe webhook testing for this app. Tell me the exact stripe listen --forward-to command for my webhook route and port, which env var gets the printed whsec_, and which stripe trigger commands cover the events my handler uses.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Stripe webhook fixer.
next: skip the next one
Skip the setup. The VibeBoot SaaS Starter ships Stripe Checkout, the billing portal and a signature-verified webhook already wired, plus auth and a database on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Stripe webhook errors
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.