API objects
Objects
Adapty API has JSON objects so you can understand a response structure and wrap it into your code.
All datetime values are ISO 8601, for example, "2020-01-15T15:10:36.517975+0000".
Profile
Info about the customer and his subscription.
Param | Type | Required | Nullable | Description |
---|---|---|---|---|
profile_id | UUID | ✅ | ❌ | Adapty profile ID |
customer_user_id | str | ✅ | ✅ | User ID in developer’s (your) system. |
paid_access_levels | dict | ✅ | ✅ | Dictionary where the keys are paid access level identifiers configured by a developer in the Adapty Dashboard. Values are CustomerAccessLevel objects. Can be null if the customer has no access levels |
subscriptions | dict | ✅ | ✅ | Dictionary where the keys are vendor product IDs. Values are Subscription objects. Can be null if the customer has no subscriptions |
non_subscriptions | dict | ✅ | ✅ | Dictionary where the keys are vendor product ids. Values are an array of Non-Subscription objects. Can be null if the customer has no purchases. |
custom_attributes | dict | ✅ | ✅ | The dictionary that collects the profile's all custom attributes about its own users. A maximum of 10 custom attributes for the profile are allowed to be set. Only strings and floats are allowed as values, booleans will be converted to floats. |
total_revenue_usd | float | ✅ | ❌ | Float value, it is equal to all total revenue USD which earned the profile. |
CustomerAccessLevel
Info about customer’s access level.
Configure which products unlock premium (paid) features in your app using the Adapty Dashboard. Then, check in the app for the access level available for a user, for example in the way below (in Swift )
if (profile.paidAccessLevels["premium"]?.isActive == true) {
/* Grant user access to paid functions of the app */
}
Param | Type | Required | Nullable | Description |
---|---|---|---|---|
id | str | ✅ | ❌ | Paid Access Level identifier configured by a developer in the Adapty Dashboard |
is_active | bool | ✅ | ❌ | Boolean indicating whether the paid access level is active |
expires_at | ISO 8601 date | ✅ | ✅ | The datetime when the access level will expire. It may be in the past and may be null for lifetime access |
starts_at | ISO 8601 date | ✅ | ✅ | The datetime when the access level will be active. May be in the future |
is_lifetime | bool | ✅ | ❌ | Boolean indicating whether the paid access level is active for a lifetime (no expiration date). If set to true you shouldn’t use expires_at |
vendor_product_id | str | ✅ | ✅ | Identifier of the product in the vendor system (App Store/Google Play/Stripe, etc.) that unlocked this access level |
base_plan_id | str | ✅ | ✅ | Base plan ID in the Google Play Store or price ID in Stripe. |
store | str | ✅ | ✅ | Store where the product was purchased. Possible values are: app_store, play_store, and adapty |
activated_at | ISO 8601 date | ✅ | ❌ | The datetime when the access level was activated. May be in the future |
renewed_at | ISO 8601 date | ✅ | ✅ | The datetime when the access level was renewed |
will_renew | bool | ✅ | ❌ | Boolean indicating whether an auto-renewable subscription is set to renew |
is_in_grace_period | bool | ✅ | ❌ | Boolean indicating whether auto-renewable subscription is in the grace period |
unsubscribed_at | ISO 8601 date | ✅ | ✅ | The datetime when an auto-renewable subscription was cancelled. Subscription can still be active, it means that auto-renewal is turned off. It will be set to null if the user reactivates the subscription |
billing_issue_detected_at | ISO 8601 date | ✅ | ✅ | The datetime when a billing issue was detected and a vendor was not able to charge the card. Subscription can still be active. Will set to null if the charge is successful |
active_introductory_offer_type | str | ✅ | ✅ | The type of active introductory offer. Possible values are: free_trial, pay_as_you_go, and pay_up_front. If the value is not null it means that the offer was applied during the current subscription period |
active_promotional_offer_type | str | ✅ | ✅ | The type of active promotional offer. Possible values are: free_trial, pay_as_you_go, and pay_up_front. If the value is not null it means that the offer was applied during the current subscription period |
Subscription
Info about vendor subscription. You don’t have to use this object in most cases, CustomerPaidAccessLevel is the preferred way to work with access to the app. When using this object, you need to implement processing logic for each subscription period (a week, a month, a year, lifetime).
Param | Type | Required | Nullable | Description |
---|---|---|---|---|
is_active | bool | ✅ | ❌ | Boolean indicating whether the subscription is active |
expires_at | ISO 8601 date | ✅ | ✅ | The datetime when access level will expire. May be in the past and may be null for lifetime access |
starts_at | ISO 8601 date | ✅ | ✅ | The datetime when the subscription will be active. May be in the future for season subscriptions |
is_lifetime | bool | ✅ | ❌ | Boolean that indicates whether the subscription is active for a lifetime without an expiration date. If set to true you shouldn’t use expires_at |
vendor_product_id | str | ✅ | ✅ | Identifier of the product in vendor system (App Store/Google Play etc.) |
base_plan_id | str | ✅ | ✅ | Base plan ID in the Google Play Store or price ID in Stripe. |
vendor_transaction_id | str | ✅ | ✅ | Transaction id in the vendor system |
vendor_original_transaction_id | str | ✅ | ✅ | Original transaction id in vendor system. For auto-renewable subscription, this will be the ID of the first transaction in the subscription |
store | str | ✅ | ✅ | Store where the product was purchased. Possible values are: app_store, play_store, and adapty |
activated_at | ISO 8601 date | ✅ | ❌ | The datetime when the access level was activated. May be in the future |
renewed_at | ISO 8601 date | ✅ | ✅ | The datetime when the access level was renewed |
will_renew | bool | ✅ | ❌ | Boolean indicating whether an auto-renewable subscription is set to renew. If a user did not cancel a subscription, will be set to true |
is_in_grace_period | bool | ✅ | ❌ | Boolean indicating whether an auto-renewable subscription is in the grace period |
unsubscribed_at | ISO 8601 date | ✅ | ✅ | The datetime when an auto-renewable subscription was canceled. Subscription can still be active, it just means that auto-renewal is turned off. Will be set to null if the user reactivates the subscription |
billing_issue_detected_at | ISO 8601 date | ✅ | ✅ | The datetime when the billing issue was detected (vendor was not able to charge the card). Subscription can still be active. Will be set to null if the charge is successful. |
active_introductory_offer_type | str | ✅ | ✅ | The type of active introductory offer. Possible values are: free_trial, pay_as_you_go, and pay_up_front. If the value is not null it means that the offer was applied during the current subscription period |
active_promotional_offer_type | str | ✅ | ✅ | The type of active promotional offer. Possible values are: free_trial, pay_as_you_go, and pay_up_front. If the value is not null it means that the offer was applied during the current subscription period |
is_sandbox | bool | ✅ | ❌ | Boolean indicating whether the product was purchased in the sandbox or production environment |
Non Subscription
Info about non-subscription purchases. These can be one-time (consumable) products, unlocks (like new map unlock in the game), etc.
Param | Type | Required | Nullable | Description |
---|---|---|---|---|
purchase_id | str | ✅ | ❌ | Identifier of the purchase in Adapty. You can use it to ensure that you’ve already processed this purchase, for example tracking one-time products |
vendor_product_id | str | ✅ | ✅ | Identifier of the product in vendor system (App Store/Google Play etc.) |
vendor_transaction_id | str | ✅ | ✅ | Transaction ID in the vendor system |
vendor_original_transaction_id | str | ✅ | ✅ | Original transaction ID in vendor system. For auto-renewable subscription, this will be the ID of the first transaction in the subscription |
store | str | ✅ | ✅ | Store where the product was purchased. Possible values are app_store, play_store, adapty |
purchased_at | ISO 8601 date | ✅ | ❌ | The datetime when the product was purchased |
is_one_time | bool | ✅ | ❌ | Boolean indicating whether the product should only be processed once. For example, if a user purchased 500 coins in a game. If true, the purchase will be returned by Adapty API one time only |
is_sandbox | bool | ✅ | ❌ | Boolean indicating whether the product was purchased in a sandbox or production environment. |