How to test and debug webhooks on localhost

Updated 2026-11-25 · by Bob, payments QA engineer

Providers send webhooks to a public URL, but your code runs on localhost. There are three ways to close that gap. Pick by what you need: just to see the payload, a full end-to-end flow, or a provider-specific test.

1. Capture first, then replay to localhost

The quickest way to see what a provider really sends, with no installation:

  1. Open the Webhook Tester and copy your URL.
  2. Paste it into the provider's dashboard as the webhook endpoint (sandbox mode) and trigger an event.
  3. Inspect the headers and the raw body. Check the signature right there.
  4. Press Replay and send the same request to http://localhost:3000/webhook, or switch on Forward new requests to localhost.

Forwarding runs from your browser, so it works behind any firewall or VPN, but only while the tab is open, and your local server must allow CORS from https://toolercat.com (only in development).

Good for: learning a payload, reproducing one specific event again and again, debugging signature checks.

2. A tunnel to your machine

A tunnel gives your local port a public HTTPS URL, so the provider talks to your code directly:

# ngrok
ngrok http 3000

# Cloudflare quick tunnel (no account needed)
cloudflared tunnel --url http://localhost:3000

Put the printed URL plus your path (for example https://xyz.trycloudflare.com/webhook) into the provider's dashboard. Quick-tunnel URLs change on every start, so you have to update the endpoint each time.

Good for: end-to-end tests with retries and real timing.

3. The provider's own CLI

Some providers ship a CLI that forwards their events to localhost. With Stripe:

stripe listen --forward-to localhost:4242/webhook
# in another terminal
stripe trigger payment_intent.succeeded

stripe listen prints a whsec_… signing secret for this session. Use it in your local config instead of the dashboard endpoint's secret, otherwise every signature check fails.

Debugging checklist

Which option to choose

NeedUse
See what the provider sendsWebhook Tester (no install)
Re-send the same event many timesWebhook Tester → Replay
Full flow with retriesTunnel (ngrok, cloudflared)
Stripe events on demandStripe CLI
A test event with a valid signatureWebhook Tester → Send a signed test event

← All guides