Webhooks resources
Webhooks notify you about events happening within Recharge. They can feed data into your client-side application that you can use to take action. Webhooks deliver data about events like customers adding an item to cart, subscription cancellations and other specific events in real-time.
Uses
You can use webhooks to collect data from our API and create a variety of custom solutions. For example, you can build custom dashboards that use webhook callback data to show information about customer purchases. Data from webhook callbacks can be used to create analytics reports store owners can use to improve the shopping experience. Your application can be reactive to Recharge's webhooks and take follow up actions like updating a subscription product when customers add it to cart.
Here is an example workflow:
If you offer a subscription where the product a customer receives should change every month, your application can listen for the order/created
callback and when it receives it, make a REST API call to change the product belonging to that subscription.
Webhooks explained
Handling the callback request
Callback payloads are identical to Recharge's REST API payloads.
For example, the callback for the subscription/created
webhook will be identical to the payload of a GET
request to the subscriptions/<subscription_id>
endpoint.
You should acknowledge you've received Recharge's webhook callback by sending a 200
OK response. If Recharge doesn't receive a response, or receives any response outside of the 200
range, Recharge will treat the payload delivery as a failure.
Webhooks retry
Recharge has a retry mechanism in place to cover for any temporary webhook delivery failure. After the first failed submission, our system will attempt to send the same webhook 19 more times over a period of 48 hours. If the request fails each time or within this timeframe, we will delete the webhook from our system. At present we also log these deleted webhooks in our system.
For every failed attempt a notification will be sent to the owner of the API token linked to the webhook. On the 19th retry ( aka 20th attempt ) the webhook will be deleted entirely and a notifcation will also be sent to the owner of the related token.
Updated 6 months ago