How to manually resend failed Stripe webhooks

If you've had issues with your webhook endpoint, and Stripe failed to send webhooks to you, it'll automatically retry with an exponential backoff. However, you might want to manually trigger the events to be resent before the automatic attempt.

Stripe allows you to do this via the UI but it's a manual process per event, there's no bulk resend, and there's no public API available to do so either.

I recently found a way to to this that involves the Stripe CLI. The CLI allows you to fetch + resend events, so with some simple piping, you can resend events very quickly.

  1. You'll need the Stripe CLI and jq installed.
  2. Fetch a secret API key from the Stripe dashboard. It'll start with sk_live_.
  3. Fetch the webhook endpoint ID you'd like to resend to:
stripe webhook_endpoints list --api-key sk_live_..
  1. You can now write a quick script to fetch and resend the events:
events=$(stripe events list --delivery-success failed --limit 100 --api-key <STRIPE_API_KEY> | jq -r '.data[].id')

for event_id in $events; do
  echo "Resending event: $event_id"
  stripe events resend $event_id --api-key <STRIPE_API_KEY> --webhook-endpoint <STRIPE_WEBHOOK_ID>