Managing entitlements
Last updated
Last updated
© Purchasely 2020-2023
When receiving an event on the Webhook, you can parse the attributes user_id
or anonymous_user_id
to determine which user is concerned by the Event.
The attribute user_id
will only be populated if a user identifier was set within the app, using the setUserId
method of Purchasely SDK.
If the user is not signed-in inside the application, you can rely on the property anonymous_id
which will be automatically populated by the Purchasely Cloud Platform.
The Event name carries the information about the event signification.
If the name is ACTIVATE
, this means that a new purchase has been made or the subscription has renewed. The corresponding user shall be entitled.
If the name is DEACTIVATE
, this means that the user subscription has expired. Entitlements shall thus be removed immediately.
Entitlements can be seen as an on/off switch.
The Event is also carrying the information related to the Product and Plan purchased by the user. These object are carrying an identifier that you can set yourself in the Purchasely Console (called vendor_id
see Configuring Products & Plans).
Sample payload for a user that has purchased the PURCHASELY_PLUS_MONTHLY
Plan attached to the PURCHASELY_PLUS
Product.