Emulating Stripe Webhooks Is Way Easier Than You Think

Steve Condylios
1 min readJul 29

--

There’s no need for ngrok.

  1. Install the stripe CLI with brew, and run stripe login to login to your stripe account.
  2. Start your app’s dev server (e.g. localhost:3000)
  3. Run stripe listen --forward-to localhost:3000/webhooks/onboarding to forward webhooks to that endpoint on your local server.
  4. In another terminal run stripe trigger account.updated to trigger a mock event to be posted to the webhook

That’s it.

Tips

  • Get a full list of events with stripe trigger --help (scroll up a bit)
  • Use stripe listen -j to output the json of the webhook to the terminal.
  • When triggering events, some require some setup which the stripe cli conveniently does for you. But that can create some noise for your webhook (for example, if you stripe trigger account.updated), the stripe cli will first create an account before it updates it, resulting in multiple events. To filter the noise for just the events you’re interested in, provide a comma-separated list to stripe listen, like so:
stripe listen --forward-to localhost:3000/webhooks/onboarding --events account.updated,account.application.deauthorized
  • To inspect a specific event
stripe events retrieve evt_kjsdfu23gjsjldkfj

Resources

--

--