Webhook

This section describes everything you need to know about the Webhook, which allows to connect your backend with the Purchasely Cloud Platform.

About the Webhook

Purchasely Webhook is a unified interface that streams subscription Events to the Client Backend.

This interface has 2 purposes :

  1. Notifying the client backend each time an event occurs on a subscriber

  2. Unifying the Events from each store into a common language, to simplify much the integration for the client backend

In other words, the main advantage of the Webhook is that it avoids to the client backend team, to develop and maintain a specific interface for each Mobile Application Store and to have to validate the native receipts.

The Webhook is used in 2 main use-cases :

  • when a new in-app purchase is performed by a user inside the mobile application.

  • when any life-cycle event happens on a subscription

Client backend responsibilities

At the client backend level, an endpoint must be developed to :

  • receive the subscription Events coming from the Webhook

  • transform these Events into actual user Entitlements

  • acknowledge the good reception of the receipt to the Purchasely Cloud Platform

The client backend is also in charge of :

  • managing the user Entitlements and providing them to the mobile applications

  • managing the access to the contents depending on the user Entitlements

In-app purchases

The first case where an Event is sent on a Webhook is when an in-app subscription is purchased by the user in the mobile application. An Event is sent on the Webhook to notify the client backend that this particular user must be entitled with the rights corresponding to the subscription.

Subscription update

The second case where Events are sent on the Webhook is when something happens in a subscription lifecycle. The main Events are :

  • the renewing of a subscription

  • the cancellation of the auto-renewing a subscription

  • the expiration of a subscription

  • a refund

  • the billing failure of a subscription

Most of these Events are coming directly from the Application Store and their Server-to-server notifications that Purchasely Cloud Platform receives.

Visualising the messages sent by the Webhook

At Purchasely, we often use the free service webhook.site. This service allows you to generate a endpoint URL (which you can plug to the Purchasely Cloud Platform using the Purchasely Console), and offers a web interface matching that endpoint showing you all the messages received by the endpoint.

Last updated

© Purchasely 2020-2023