Instead of polling data from the endpoints, you can use webhooks to get notified about:
- redemption details (redemption is done, redemption failed, etc.)
- triggering a referral reward
- redemption rollback
You can configure the webhook in the Project's settings view, in the Webhooks section.
- Call a webhook for every redemption.
- Call a webhook given the one or many of following redemption statutes occurred: `redemption succeeded`, `redemption failed`, `redemption rollback succeeded`, `redemption rollback failed`.
Referral webhook reward
The webhooks are also an integral part of referral programs. The endpoints are defined while defining a referral program and they are invoked when the referrer becomes eligible to receive a reward. The configuration is described in this tutorial.
Responding to a webhook
Voucherify expects your webhook to return a response with a `2XX` HTTP status code, indicating that the webhook has been received successfully. If a webhook is not successfully received for any reason, Voucherify will continue trying to send the webhook once an hour for up to 3 days.