Skip to main content

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.

ParamTypeRequiredNullableDescription
profile_idUUIDAdapty profile ID
customer_user_idstrUser ID in developer’s (your) system.
paid_access_levelsdictDictionary 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
subscriptionsdictDictionary where the keys are vendor product IDs. Values are Subscription objects. Can be null if the customer has no subscriptions
non_subscriptionsdictDictionary 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_attributesdictThe 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_usdfloatFloat 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 )

Swift
if (profile.paidAccessLevels["premium"]?.isActive == true) {
/* Grant user access to paid functions of the app */
}
ParamTypeRequiredNullableDescription
idstrPaid Access Level identifier configured by a developer in the Adapty Dashboard
is_activeboolBoolean indicating whether the paid access level is active
expires_atISO 8601 dateThe datetime when the access level will expire. It may be in the past and may be null for lifetime access
starts_atISO 8601 dateThe datetime when the access level will be active. May be in the future
is_lifetimeboolBoolean 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_idstr

This is the product ID from the vendor's system (App Store, Google Play, Stripe, etc.) that unlocked the access level.

If an access level was granted without a transaction, one of the following values will be returned:

base_plan_idstrBase plan ID in the Google Play Store or price ID in Stripe.
storestrStore where the product was purchased. Possible values are: app_store, play_store, and adapty
activated_atISO 8601 dateThe datetime when the access level was activated. May be in the future
renewed_atISO 8601 dateThe datetime when the access level was renewed
will_renewboolBoolean indicating whether an auto-renewable subscription is set to renew
is_in_grace_periodboolBoolean indicating whether auto-renewable subscription is in the grace period
unsubscribed_atISO 8601 dateThe 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_atISO 8601 dateThe 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_typestrThe 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_typestrThe 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).

ParamTypeRequiredNullableDescription
is_activeboolBoolean indicating whether the subscription is active
expires_atISO 8601 dateThe datetime when access level will expire. May be in the past and may be null for lifetime access
starts_atISO 8601 dateThe datetime when the subscription will be active. May be in the future for season subscriptions
is_lifetimeboolBoolean 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_idstr

This is the product ID from the vendor's system (App Store, Google Play, Stripe, etc.) that unlocked the access level.

If an access level was granted without a transaction, one of the following values will be returned:

base_plan_idstrBase plan ID in the Google Play Store or price ID in Stripe.
vendor_transaction_idstrTransaction id in the vendor system
vendor_original_transaction_idstrOriginal transaction id in vendor system. For auto-renewable subscription, this will be the ID of the first transaction in the subscription
storestrStore where the product was purchased. Possible values are: app_store, play_store, and adapty
activated_atISO 8601 dateThe datetime when the access level was activated. May be in the future
renewed_atISO 8601 dateThe datetime when the access level was renewed
will_renewboolBoolean 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_periodboolBoolean indicating whether an auto-renewable subscription is in the grace period
unsubscribed_atISO 8601 dateThe 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_atISO 8601 dateThe 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_typestrThe 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_typestrThe 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_sandboxboolBoolean 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.

ParamTypeRequiredNullableDescription
purchase_idstrIdentifier 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_idstr

This is the product ID from the vendor's system (App Store, Google Play, Stripe, etc.) that unlocked the access level.

If an access level was granted without a transaction, one of the following values will be returned:

vendor_transaction_idstrTransaction ID in the vendor system
vendor_original_transaction_idstrOriginal transaction ID in vendor system. For auto-renewable subscription, this will be the ID of the first transaction in the subscription
storestrStore where the product was purchased. Possible values are app_store, play_store, adapty
purchased_atISO 8601 dateThe datetime when the product was purchased
is_one_timeboolBoolean 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_sandboxboolBoolean indicating whether the product was purchased in a sandbox or production environment.