Skip to main content

Webhooks

IAPHUB can send a notification to your server when an event occurs.
You can enable webhooks by providing in the settings the endpoint of your server that should be reached.

It is particularly usefull to unlock a feature on your server when a user purchase a product such as a consumable or a subscription.

Request

The webhook will be sent as a POST request to your server, you should check the X-Auth-Token header to validate that the request comes from IAPHUB. Your server must return a 200 status code.

info

The request will be sent from one of the following IPs: 18.190.151.13, 18.218.125.16

info

If the request fails, we'll send you an alert and retry directly one more time and then again in 1 minute, 10 minutes, 1 hour and 24 hours. You can retry sending a request directly from the dashboard as well.

Request body

The body of the request will contain a JSON object with some properties common to any event:

{
id: "5e7fdfe22a3cff5084466e79"
type: "..."
createdDate: "2019-10-12T17:34:35.256Z"
version: "1.8.0"
}
StringId of the webhook event
StringThe type of event, it can be one of the following:
NameDescription
purchaseA product has been purchased (triggered for subscriptions as well if it isn't a renewal)
refundA purchase has been refunded
transaction_updateThe data of a transaction has been updated
user_id_updateA user id has been updated
subscription_renewalA subscription has been renewed
subscription_renewal_retryA subscription renewal has failed but will be retried
subscription_grace_period_expireA subscription grace period has ended
subscription_product_changeA subscription product has been changed (will be replaced at the next renewal date)
subscription_replaceA subscription has been replaced by a new subscription with a different product
subscription_cancelA subscription auto-renewal has been cancelled (but is still active)
subscription_uncancelThe auto-renewal of a subscription previously cancelled is now active
subscription_expireA subscription has expired
subscription_pauseA subscription has been paused (Android only)
subscription_pause_enabledA subscription pause has been enabled (Android only)
subscription_pause_disabledA subscription pause has been disabled (Android only)
StringVersion of the webhook format, using semantic versioning.
The latest version available is 1.8.0, you must update your settings to upgrade your webhooks format to a MAJOR version.