Events

This page describes the event sent by Purchasely Cloud Platform to our customers backend through our web hook.

Mandatory events

The following events are the ones that your backend MUST implement. They are basically a switch to lock and unlock content / service to your users.

You MUST return a HTTP 200 to tell our backend that you successfully handled the message. If you don't we will continue sending you the message following our retry strategy.

Event name

You MUST do

You CAN do

ARS

NRS

NC

C

PURCHASE_VALIDATED

Sent when a user purchases an in-app item.

Unlock access to the purchase for the given user️.

Send a Welcome Package to the User (email etc...)

SUBSCRIPTION_RENEWED Sent when the renewal has been successful and billing has been properly processed OR when the user reactivates a paused subscription.

Unlock access to the purchase for the given user.

SUBSCRIPTION_EXPIRED Sent when the subscription expires or has been refund

Immediately revoke access to the purchase for the given user.

Send a winback offer. Send an email to reengage the customer.

ARS: Auto Renewing Subscription NRS: Non Renewing Subscription NC: Non-Consumable C: Consumable

Sample JSON messages

PURCHASE_VALIDATED
SUBSCRIPTION_RENEWED
SUBSCRIPTION_EXPIRED
PURCHASE_VALIDATED
{
"name": "PURCHASE_VALIDATED",
"user": {
"vendor_id": "5e2dd8f8a372b06a32e9e73c" // or "anonymous_id" if not logged_in
},
"properties": {
"product": {
"vendor_id": "PURCHASELY_PLUS",
"plan": {
"type": "RENEWING_SUBSCRIPTION",
"vendor_id": "PURCHASELY_PLUS_MONTHLY"
}
},
"store": "APPLE_APP_STORE", // can be GOOGLE_PLAY_STORE | HUAWEI_APP_GALLERY | AMAZON_APP_STORE
"app": {
"platform": "IOS", // can be ANDROID
"package_id": "io.purchasely.app"
},
"expires_at": "2020-09-25T14:30:37.000Z",
"is_trial_period": true,
"purchased_at": "2020-08-25T14:30:37.000Z"
},
"received_at": "2020-08-25T14:31:04.469Z"
}
SUBSCRIPTION_RENEWED
{
"name": "SUBSCRIPTION_RENEWED",
"user": {
"vendor_id": "5e2dd8f8a372b06a32e9e73c" // or "anonymous_id" if not logged_in
},
"properties": {
"product": {
"vendor_id": "PURCHASELY_PLUS",
"plan": {
"type": "RENEWING_SUBSCRIPTION",
"vendor_id": "PURCHASELY_PLUS_MONTHLY"
}
},
"store": "APPLE_APP_STORE", // can be GOOGLE_PLAY_STORE | HUAWEI_APP_GALLERY | AMAZON_APP_STORE
"app": {
"platform": "IOS", // can be ANDROID
"package_id": "io.purchasely.app"
},
"expires_at": "2020-09-25T14:30:37.000Z",
"is_trial_period": false,
"purchased_at": "2020-08-25T14:30:37.000Z"
},
"received_at": "2020-08-25T14:31:04.469Z"
}
SUBSCRIPTION_EXPIRED
{
"name": "SUBSCRIPTION_EXPIRED",
"user": {
"vendor_id": "5e2dd8f8a372b06a32e9e73c" // or "anonymous_id" if not logged_in
},
"properties": {
"product": {
"vendor_id": "PURCHASELY_PLUS",
"plan": {
"type": "RENEWING_SUBSCRIPTION",
"vendor_id": "PURCHASELY_PLUS_MONTHLY"
}
},
"store": "APPLE_APP_STORE", // can be GOOGLE_PLAY_STORE | HUAWEI_APP_GALLERY | AMAZON_APP_STORE
"app": {
"platform": "IOS", // can be ANDROID
"package_id": "io.purchasely.app"
},
"expires_at": "2020-09-25T14:29:00.000Z",
"is_trial_period": false,
"purchased_at": "2020-08-25T14:30:37.000Z"
},
"received_at": "2020-08-25T14:31:04.469Z"
}

Properties

You will only need to look a at 2 properties to make it work:

  • user/vendor_id or user/anonymous_id (if user/vendor_id is null) to identify the user and grant him with the access to the ressource he purchased.

  • product/plan/vendor_id to identify precisely what the user has subscribed to. You may also refer to product/vendor_id for more details.

The JSON contains more informations that might be useful for analytics or more precise marketing actions you might want to trigger:

  • purchased_at and expires_at

  • store to identify the store it was purchased from

  • platform to identify the app

Other events

Some other optional events are sent to your server. They are really helpful for marketing purposes to increase engagement, reduce churn or help upselling.

Event name

You CAN do

ARS

NRS

NC

C

RENEWAL_DISABLED

Sent when the user cancels the subscription.

Send an email / push to collect the reason of cancellation.

Push a win back offer

RENEWAL_ENABLED

Sent when the user reactivates its subscription.

Send a congratulation / thank you email.

TRIAL_STARTED

Sent when the user starts a trial (free or discount)

Send a mail "Enjoy the most from your subscription" email.

TRIAL_CONVERTED

Sent when the user passes from a trial to a regular price

Send a thank you email with all the content / services the user can take advantage of.

TRIAL_NOT_CONVERTED

Sent when the user cancels its subscription during the free trial

Send an email to re-engage the user presenting all the advantages of your product.

ARS: Auto Renewing Subscription NRS: Non Renewing Subscription NC: Non-Consumable C: Consumable

Some new events will be triggered very soon (TRIAL_CONVERTED, SUBSCRIPTION_UNPAID, SUBSCRIPTION_CHANGED) to let you take marketing actions.