Process undelivered webhook events
Learn how to manually process undelivered webhook events.
If your webhook endpoint temporarily can’t process events, Stripe automatically resends the undelivered events to your endpoint for up to three days, increasing the time for your webhook endpoint to eventually receive and process all events.
This guide explains how to speed up that process by manually processing the undelivered events.
List webhook events
Call the List Events API with the following parameters:
ending_
: Specify an event ID that was sent just before the webhook endpoint became unavailable.before types
: Specify the list of event types to retrieve.delivery_
: Set tosuccess false
to retrieve events that were unsuccessfully delivered to at least one of your webhook endpoints.
Stripe only returns events created in the last 30 days.
By default, the response returns up to 10 events. To retrieve all events, use auto-pagination after retrieving the results.
Using ending_
with auto-pagination returns events in chronological order. This lets you process events in their created order.
Process the events
Process only unsuccessfully processed events according to your own logic to avoid processing a single event multiple times by, for example:
- Inadvertently running the script twice in a row
- Simultaneously running the script while Stripe automatically resends some of the unprocessed events
Define the following functions that prevent processing duplication:
is_
to check the event’s status in your database.processing_ or_ processed mark_
to update your database to mark the event as processing.as_ processing mark_
to update your database to mark the event as processed.as_ processed
Respond to automatic retries
Stripe still considers your manually preocessed events as undelivered, so continues to automaticly retry them.
When your webhook endpoint receives an already processed event, ignore the event and return a successful response to stop future retries.