Stripe·Fixpaymentsintermediate

How to Test Stripe Webhooks Locally

Quick Answer

Stripe sends webhooks to a public URL. Your localhost isn't public. The Stripe CLI forwards webhooks to your local server. Start with "Install and use Stripe CLI" before making broader code changes.

You're in the right place if...

  • !Webhooks work on Stripe but not locally
  • !Can't test payment flows in development
  • !No way to trigger webhook events

Why this happens

Stripe sends webhooks to a public URL. Your localhost isn't public. The Stripe CLI forwards webhooks to your local server.

Fix

1

Install and use Stripe CLI

The CLI forwards Stripe events to your local server:

# Install Stripe CLI
brew install stripe/stripe-cli/stripe

# Login
stripe login

# Forward webhooks to localhost
stripe listen --forward-to localhost:3000/api/webhooks/stripe

# In another terminal, trigger a test event
stripe trigger payment_intent.succeeded

Prevent this next time

Always test webhooks locally before deploying. The Stripe CLI makes this easy.

Frequently Asked Questions

For local webhook testing, yes. It's the only way to forward Stripe events to localhost.

If you export to GitHub and run locally, yes. In Lovable's preview, webhooks go to Lovable's URL directly.

Related fixes

Weekly Newsletter

Get next week's fix before you need it.

Join developers getting weekly vibe coding tips, error fixes, and tool updates.

Subscribe on Substack →