Events attributes

Attributes

All our subscription events are broadcast with attributes, you will find here the full list of those attributes and their specifics. We encourage you to use those attributes to take decision (for exemple whether you will make a special offer to your customer or not) and to tailor your communications.

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

  • user_id or anonymous_user_id to identify the user and grant him with the access to the ressource he purchased.

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

AttributeDescriptionMandatory

api_version

int

Contains the webhook API version.

Yes

event_name

string

Contains the name of the event. learn more

Yes

event_created_at

string

in ISO 8601

Contains the date which the event was sent the first time. In case of retry that attribute will still be set with the time at the first try.

Yes

event_created_at_ms

int

in milliseconds since the Epoch

Contains the date which the event was sent the first time. In case of retry that attribute will still be set with the time at the first try.

Yes

product

string

Contains the Product id that carries the plan that was bought. Reference to the Product vendor id you created in the Purchasely console (see Configuring Products & Plans).

Yes

content_id

string

Contains the content_id you may have set on the SDK to display the paywall. learn more

No

plan

string

Contains the Plan id that was bought. Reference to the Plan vendor id you created in the Purchasely console (see Configuring Products & Plans).

No

previous_plan

string

Contains the Plan vendor id the customer used to have before changing plan.

Used with for the following events :

  • SUBSCRIPTION_CROSSGRADED

  • SUBSCRIPTION_DOWNGRADED

  • SUBSCRIPTION_UPGRADED

No

store

string

Contains the name of the Store through which the purchase was made.

Possible values :

  • APPLE_APP_STORE

  • GOOGLE_PLAY_STORE

  • AMAZON_APPSTORE

  • HUAWEI_APPGALLERY

Yes

store_country

string

in ISO 3166

Contains the store country where the purchase was made.

Can be NULL in case the subscription was purchased before Purchasely was implemented in your system.

Yes

purchasely_subscription_id

string

Contains the Purchasely internal unique idendifier of the subscription.

Used with events that regards a subscription.

No

purchasely_one_time_purchase_id

string

Contains the Purchasely internal unique idendifier of the one time purchase.

Used with all events that regards a one time purchase.

No

store_product_id

string

Contains the product_id you created in the store console.

Yes

store_transaction_id

string

Contains the transaction_id given by the store.

Yes

purchased_at

string

in ISO 8601

Contains the date of the last transaction (original purchase or renewal).

Yes

purchased_at_ms

int

in milliseconds since the Epoch

Contains the date of the last transaction (original purchase or renewal).

Yes

store_original_transaction_id

string

Contains the store_transaction_id of the first transaction.

Yes

original_purchased_at

string

in ISO 8601

Contains the date of the first transaction.

Yes

original_purchased_at_ms

int

in milliseconds since the Epoch

Contains the date of the first transaction.

Yes

anonymous_user_id

string

Contains the anonymous_user_id that holds the purchase.

That attribute will be filled with a Purchasely generated anonymous_id if your app doesn't require the user to be logged in and/or you didn't specified to us a user_id.

No

user_id

string

Contains the user_id that holds the purchase.

That attribute will be filled with the user_id you provided us through the SDK.

No

transferred_from_anonymous_user_id

string

Contains the anonymous_user_id the subscription was transferred from.

That attribute is filled for the following event :

  • SUBSCRIPTION_RECEIVED

No

transferred_to_anonymous_user_id

string

Contains the anonymous_user_id the subscription was transferred to.

That attribute is filled for the following event :

  • SUBSCRIPTION_TRANSFERRED

No

transferred_from_user_id

string

Contains the user_id the subscription was transferred from.

That attribute is filled for the following event :

  • SUBSCRIPTION_RECEIVED

No

transferred_to_user_id

string

Contains the user_id the subscription was transferred to.

That attribute is filled for the following event :

  • SUBSCRIPTION_TRANSFERRED

No

environment

string

Contains the environment from where the purchase was made.

Possible values :

  • SANDBOX

  • PRODUCTION

Yes

is_family_shared

bool

Contains true or false depending on if the user has access to the subscription thanks to family sharing.

No

previous_offer_type

string

Contains the previous offer the subscription was under.

That attribute is always filled for events that regards subscriptions except for the very first ACTIVATE and SUBSCRIPTION_STARTED.

Possible values :

  • INTRO_OFFER

  • FREE_TRIAL

  • PROMOTIONAL_OFFER

  • OFFER_CODE

  • NONE

No

offer_type

string

Contains the current offer the subscription is under.

Possible values :

  • INTRO_OFFER

  • FREE_TRIAL

  • PROMOTIONAL_OFFER

  • OFFER_CODE

  • NONE

Yes

subscription_status

string

Contains the current status of the subscription.

Filled for events that regards a subscription.

Possible Values :

  • AUTO_RENEWING

  • ON_HOLD

  • IN_GRACE_PERIOD

  • AUTO_RENEWING_CANCELED

  • DEACTIVATED

  • REVOKED

  • PAUSED

No

grace_period_expires_at

string

in ISO 8601

Filled for events that regards a subscription which is in grace period.

Contains the date when the grace period will end.

No

grace_period_expires_at_ms

int

Filled for events that regards a subscription which is in grace period.

Contains the date when the grace period will end in milliseconds since the Epoch.

No

effective_next_renewal_at

string

in ISO 8601

Filled for events that regards a subscription.

Contains the effective next renewal date, taking any grace or defer periods into account. If the subscription isn’t in grace or deferring period the effective date is equal to next_renewal_at.

effective_next_renewal_at_ms

int

in milliseconds since the Epoch.

Filled for events that regards a subscription.

Contains the effective next renewal date, taking any grace or defer periods into account. If the subscription isn’t in grace or deferring period the effective date is equal to next_renewal_at.

next_renewal_at

string

in ISO 8601

Filled for events that regards a subscription.

Contains the theoretical next automatic renewal date.

See effective_newt_renewal_at.

No

next_renewal_at_ms

int

in milliseconds since the Epoch

Filled for events that regards a subscription.

Contains the theoretical next automatic renewal date.

See effective_next_renewal_at.

No

defer_end_at

string

in ISO 8601

Filled for events that regards a subscription.

Contains the date when the free time offered will be ending.

No

defer_end_at_ms

int

in milliseconds since the Epoch

Filled for events that regards a subscription.

Contains the date when the free time offered will be ending.

No

auto_resume_at

string

in ISO 8601

Filled for events that regards a subscription.

Contains the date when the pause will be ending and the subscription will resume.

No

auto_resume_at_ms

int

in milliseconds since the Epoch.

Filled for events that regards a subscription.

Contains the date when the pause will be ending and the subscription will resume.

No

JSON Samples

{
  "plan": "<plan vendorID defined in the Purchasely console>",
  "store": "APPLE_APP_STORE",
  "product": "<product vendorID define in the Purchasely console>",
  "user_id": "<user id you provided through the sdk>",
  "event_name": "SUBSCRIPTION_STARTED",
  "offer_type": "NONE",
  "api_version": 3,
  "environment": "SANDBOX",
  "purchased_at": "2021-11-07T17:41:17.000Z",
  "store_country": "FR",
  "next_renewal_at": "2021-11-07T17:44:17.000Z",
  "purchased_at_ms": 1636306877000,
  "event_created_at": "2021-11-07T17:41:34.188Z",
  "is_family_shared": false,
  "store_product_id": "<store product id defined in the store console>",
  "next_renewal_at_ms": 1636307057000,
  "event_created_at_ms": 1636306894188,
  "store_app_bundle_id": "<app bundle id defined in the store console>",
  "subscription_status": "AUTO_RENEWING",
  "store_transaction_id": "100000099999999",
  "original_purchased_at": "2021-11-07T17:41:18.000Z",
  "original_purchased_at_ms": 1636306878000,
  "effective_next_renewal_at": "2021-11-07T17:44:17.000Z",
  "purchasely_subscription_id": "subs_XFJFJEBFFU757FUJH",
  "effective_next_renewal_at_ms": 1636307057000,
  "store_original_transaction_id": "10000009999999"
}

Last updated

© Purchasely 2020-2023