Stripe can send webhook events that notify your application any time an event happens on your account. This is especially useful for events—like disputed charges and recurring billing events—that are not triggered by a direct API request. This mechanism is also useful for services that are not directly responsible for making an API request, but still need to know the response from that request.
When to use webhooks
Webhooks are necessary only for behind-the-scenes transactions. Most Stripe requests (e.g., creating charges or refunds) generate results that are reported synchronously to your code. These don’t require webhooks for verification.
However, the Payment Intents API with automatic confirmation and most payment methods using Sources require using webhooks, so that your integration can be notified about asynchronous changes to the status of PaymentIntent and Source objects.
You might also use webhooks as the basis to:
- Update a customer’s membership record in your database when a subscription payment succeeds
- Email a customer when a subscription payment fails
- Examine the Dashboard if you see that a dispute was filed
- Make adjustments to an invoice when it’s created (but before it’s been paid)
- Log an accounting entry when a transfer is paid