Stripe·Fixpaymentsintermediate

How to Test Stripe Webhooks Locally

Quick Answer

How do I fix How to Test Stripe Webhooks Locally?

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.

Fix signals

What this answers
Why how to test stripe webhooks locally happens and what to change first.
Fastest move
Install and use Stripe CLI
Use this page if
Webhooks work on Stripe but not locally

If this keeps happening

Open the next decision, not just the patch

Use these when the current fix is helpful, but the real answer is a better tool choice, a cleaner workflow layer, or a more trustworthy launch path.

Quick Fix Summary

Most likely causeStripe sends webhooks to a public URL. Your localhost isn't public. The Stripe CLI forwards webhooks to your local server.
Fastest fixInstall and use Stripe CLI
Use this page ifWebhooks work on Stripe but not locally

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