API 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”.
Access level
Info about customer’s access level.
Access levels let you control what your app’s users can do in your mobile app without hardcoding specific product IDs. Each product defines how long the user gets a certain access level. So, whenever a user makes a purchase, Adapty grants access to the app for a specific period (for subscriptions) or forever (for lifetime purchases). Alternatively, you can grant specific access for a specified time to a user via server-side API.
You can do the following action via Adapty server-side API:
- Check users’s access level by retrieving their profile details
- Grant specific access to your end user without providing a transaction
- Set transaction and grant access level to your end user
- Revoke access level from your end user
| Paramètre | Type | Requis | Nullable | Description |
|---|---|---|---|---|
| access_level_id | String | Oui | Non | ID du niveau d’accès payant configuré dans l’Adapty Dashboard. |
| store | String | Oui | Non | Store où le produit a été acheté. Options : app_store, play_store, stripe, ou le nom de votre store personnalisé. |
| store_product_id | String | Oui | Non | ID du produit dans le store (App Store, Google Play, Stripe) qui a débloqué ce niveau d’accès. |
| store_base_plan_id | String | Oui | Oui | ID du plan de base dans Google Play ou ID de prix dans Stripe. |
| store_transaction_id | String | Oui | Non | ID de transaction dans le store (App Store, Google Play, Stripe, etc.). |
| store_original_transaction_id | String | Oui | Non | Pour les abonnements, cet ID relie la transaction d’origine dans la chaîne de renouvellements. Les transactions ultérieures sont liées en tant que renouvellements. S’il n’y a pas de renouvellement, store_original_transaction_id correspond à store_transaction_id. |
| offer | Object | Oui | Non | L’objet Offer. Peut être null si le client n’a aucun niveau d’accès. |
| environment | String | Non | Non | Environnement pour la transaction ayant accordé l’accès. Options : Sandbox, Production. |
| starts_at | ISO 8601 date | Oui | Oui | Date et heure d’activation du niveau d’accès. Peut être dans le futur. |
| purchased_at | ISO 8601 date | Oui | Non | Date et heure du dernier achat pour ce niveau d’accès. |
| originally_purchased_at | ISO 8601 date | Oui | Non | Pour les abonnements, date et heure du tout premier achat (d’origine) dans la chaîne, lié à store_original_transaction_id. |
| expires_at | ISO 8601 date | Oui | Oui | Date et heure d’expiration du niveau d’accès. Peut être dans le passé, ou null pour un accès à vie. |
| renewal_cancelled_at | ISO 8601 date | Oui | Oui | Date et heure à laquelle le renouvellement automatique a été désactivé pour un abonnement. L’abonnement peut toujours être actif ; il ne se renouvellera simplement plus automatiquement. Mis à null si l’utilisateur réactive l’abonnement. |
| billing_issue_detected_at | ISO 8601 date | Oui | Oui | Date et heure à laquelle un problème de facturation a été détecté (par exemple, un échec de débit de carte). L’abonnement peut toujours être actif. Ce champ est effacé si le paiement aboutit ultérieurement. |
| is_in_grace_period | Boolean | Oui | Non | Indique si l’abonnement est dans un délai de grâce (uniquement pour les abonnements à renouvellement automatique). |
| cancellation_reason | String | Oui | Oui | Raison de l’annulation, parmi les options suivantes : voluntarily_cancelled, billing_error, price_increase, product_was_not_available, refund, upgraded, unknown. |
Although the SDK includes the is_active parameter to check if a subscription is active, the server-side API does not provide this parameter. However, you can determine subscription status at any time by checking whether the current date falls between the starts_at and expires_at parameters.
Installation Meta
Information about installation of the app on a specific device.
You can do the following action via Adapty server-side API:
| Parameter | Type | Required | Nullable | Description |
|---|---|---|---|---|
| device_id | String | Yes | No | The device identifier is generated on the client side. |
| device | String | No | Yes | The end-user-visible device model name. |
| locale | String | No | Yes | The locale used by the end user. |
| os | String | No | Yes | The operating system used by the end user. |
| platform | String | No | Yes | The device platform used by the end user. |
| timezone | String | No | Yes | The timezone of the end user. |
| user_agent | String | No | Yes | Details about the end user environment: device, operating system, and browser information of the end user interacting with your application. |
| idfa | String | No | Yes | The Identifier for Advertisers, assigned by Apple to a user’s device. |
| idfv | String | No | Yes | The Identifier for Vendors (IDFV) is a code assigned to all apps by one developer and is shared across all apps by that developer on your device. |
| advertising_id | String | No | Yes | The Advertising ID is a unique identifier offered by the Android Operating System that advertisers might use to uniquely identify you. |
| android_id | String | No | Yes | On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device. For more details, see Android developer documentation. |
| android_app_set_id | String | No | Yes | An AppSetId - unique, per-device, per developer-account user-resettable ID for non-monetizing advertising use cases. |
Non Subscription
Info about non-subscription purchases. These can be one-time (consumable) products, unlocks (like new map unlock in the game), etc.
You can do the following action via Adapty server-side API:
- Check user’s current non-subscriptions by retrieving their profile details
| Parameter | Type | Required | Nullable | Description |
|---|---|---|---|---|
| purchase_id | String | Yes | No | 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. |
| store | String | Yes | No | Store where the product was purchased. Possible values are: app_store, play_store, stripe, name of your custom store. |
| store_product_id | String | Yes | No | Identifier of the product in the app store (App Store/Google Play/Stripe, etc.) that unlocked this access level. |
| store_base_plan_id | String | Yes | Yes | Base plan ID in the Google Play Store or price ID in Stripe. |
| store_transaction_id | String | Yes | No | The ID of the transaction in the app store (App Store/Google Play/Stripe, etc.). |
| store_original_transaction_id | String | Yes | No | In case of prolonged subscriptions, a chain of subscriptions is generated. The original transaction i the very first transaction in this chain and the chain is linked by it. Other transactions in the chain are prolongations. If no prolongation, |
| purchased_at | ISO 8601 date | Yes | No | The datetime when the access level was purchased the latest time. |
| environment | String | No | No | Environment of the transaction that provided the access level. Possible values: Sandbox, Production. |
| is_refund | Boolean | Yes | No | Indicates if the product has been refunded. |
| is_consumable | Boolean | Yes | No | Indicates whether the product is consumable. |
One-Time Purchase
| Parameter | Type | Required | Nullable | Description |
|---|---|---|---|---|
| purchase_type | String | Oui | Non | Le type de produit acheté. Valeur possible : one_time_purchase. |
| store | String | Oui | Non | Store où le produit a été acheté. Valeurs possibles : app_store, play_store, stripe, ou l’ID de votre store personnalisé. |
| environment | String | Non | Non | Environnement de transaction qui a fourni le niveau d’accès. Options : Sandbox, Production. Production est utilisé par défaut. |
| store_product_id | String | Oui | Non | L’ID du produit dans le store (App Store, Google Play, Stripe, etc.) qui a déverrouillé ce niveau d’accès. |
| store_transaction_id | String | Oui | Non | ID de transaction dans le store (App Store, Google Play, Stripe, etc.). |
| store_original_transaction_id | String | Oui | Non | Pour les abonnements récurrents, il s’agit de l’ID de transaction d’origine qui relie la chaîne de renouvellements. La transaction d’origine est la première de la chaîne ; les transactions suivantes sont des renouvellements. S’il n’y a pas de renouvellement, |
| offer | Object | Non | Oui | L’offre utilisée pour l’achat, sous forme d’objet Offer. |
| is_family_shared | Boolean | Non | Non | Valeur booléenne indiquant si le produit prend en charge le partage familial dans App Store Connect. iOS uniquement. Toujours false pour iOS en dessous de 14.0 et macOS en dessous de 11.0. false est utilisé par défaut. |
| price | Object | Oui | Non | Prix de l’achat unique sous forme d’objet Price. Un premier achat d’abonnement à coût zéro est un essai gratuit ; un renouvellement à coût zéro est un renouvellement gratuit. |
| purchased_at | ISO 8601 date | Oui | Non | La date et l’heure du dernier achat du niveau d’accès. |
| refunded_at | ISO 8601 date | Non | Non | En cas de remboursement, indique la date et l’heure du remboursement. |
| cancellation_reason | String | Non | Non | Raisons possibles d’annulation : voluntarily_cancelled, billing_error, price_increase, product_was_not_available, refund, cancelled_by_developer, new_subscription, unknown. |
| variation_id | String | Non | Non | L’ID de variante utilisé pour relier les achats au paywall spécifique depuis lequel ils ont été effectués. |
Offer
Information on the applied offer. The Offer object is a part of the Subscription, and Access level objects.
You can do the following actions with offers via Adapty server-side API:
- Apply offer when setting a transaction to your user
| Parameter | Type | Required | Nullable | Description |
|---|---|---|---|---|
| category | String | Yes | No | The category of the applied offer. Options are: introductory, promotional, offer_code, win_back. |
| type | String | Yes | No | The type of active offer. Options are: free_trial, pay_as_you_go, pay_up_front, and unknown. If this isn’t null, it means the offer was applied in the current subscription period. |
| id | String | No | Yes | The ID of the applied offer. |
Price
Information about the cost of your product in local currency. The Price object is a part of the Subscription and Purchase objects.
You can do the following actions with product price via Adapty server-side API:
- Set transaction to your user and specify its price
| Parameter | Type | Required | Nullable | Description |
|---|---|---|---|---|
| country | String | Yes | No | The country where the price applies. |
| currency | String | Yes | No | The currency used for the price. |
| value | Float | Yes | No | The product’s cost in the local currency. |
Profile
Info about the customer and their subscription
You can do the following actions with user profiles via Adapty server-side API:
- Retrieve/get the end-user’s profile with their access levels, subscriptions, non-subscriptions, etc.
- Create a new end-user profile
- Update your end-user profile
- Delete your end-user
| Paramètre | Type | Nullable | Description |
|---|---|---|---|
| app_id | String | :heavy_minus_sign: | L’ID interne de votre application. Vous pouvez le voir dans l’Adapty Dashboard : App Settings -> General tab. |
| profile_id | UUID | :heavy_minus_sign: | ID de profil Adapty. Vous pouvez le voir dans le champ Adapty ID sur l’Adapty Dashboard -> Profiles -> page du profil concerné. |
| customer_user_id | String | :heavy_plus_sign: | L’ID de votre utilisateur dans votre système. Vous pouvez le voir dans le champ Customer user ID sur l’Adapty Dashboard -> Profiles -> page du profil concerné. Cela ne fonctionne que si vous identifiez les utilisateurs dans le code de votre application mobile via le SDK Adapty. |
| total_revenue_usd | Float | :heavy_minus_sign: | Valeur décimale représentant le revenu total en USD généré par le profil. |
| segment_hash | String | :heavy_minus_sign: | Paramètre interne. |
| timestamp | Integer | :heavy_minus_sign: | Temps de réponse en millisecondes, nécessaire pour résoudre une condition de concurrence. |
| custom_attributes | Array | :heavy_minus_sign: | Un maximum de 30 attributs personnalisés peuvent être définis sur le profil. Si vous fournissez le tableau Clé : La clé doit être une chaîne de 30 caractères maximum. Seuls les lettres, chiffres, tirets, points et underscores sont autorisés. Valeur : La valeur de l’attribut ne doit pas dépasser 30 caractères. Seules les chaînes et les nombres décimaux sont acceptés comme valeurs ; les booléens seront convertis en nombres décimaux. Envoyez une valeur vide ou null pour supprimer l’attribut. |
| access_levels | Array | :heavy_plus_sign: | Tableau d’objets Niveau d’accès. Peut être null si le client n’a aucun niveau d’accès. |
| subscriptions | Array | :heavy_plus_sign: | Tableau d’objets Abonnement. Peut être null si le client n’a aucun abonnement. |
| non_subscriptions | Array | :heavy_plus_sign: | Tableau d’objets Non-Subscription. Peut être null si le client n’a effectué aucun achat. |
Product
This object contains details about a product in Adapty.
| Name | Type | Required | Description |
|---|---|---|---|
| title | String | No | Product name from the Products section in the Adapty Dashboard. |
| is_consumable | Boolean | Yes | Indicates whether the product is consumable. |
| adapty_product_id | UUID | No | Internal product ID as used in Adapty. |
| vendor_product_id | String | Yes | The product ID in app stores. If access was granted without a real store transaction,
|
| introductory_offer_eligibility | Boolean | No | Specifies if the user is eligible for an iOS introductory offer. |
| promotional_offer_eligibility | Boolean | No | Specifies if the user is eligible for a promotional offer. |
| base_plan_id | String | No | Base plan ID for Google Play or price ID for Stripe. |
| offer | JSON | No | An Offer object as a JSON. |
{
"title": "Monthly Subscription w/o Trial",
"is_consumable": true,
"adapty_product_id": "InternalProductId",
"vendor_product_id": "onemonth_no_trial",
"introductory_offer_eligibility": false,
"promotional_offer_eligibility": true,
"base_plan_id": "B1",
"offer": {
"category": "promotional",
"type": "pay_up_front",
"id": "StoreOfferId"
}
}
RemoteConfig
This object contains information about a remote config for a paywall.
{
"lang": "en",
"data": "{\"bodyItems\":[{\"spacerValue\":{\"height\":20,\"style\":{\"type\":\"emptySpace\"}},\"type\":\"spacer\"},{\"mediaValue\":{\"ratio\":\"1:1\",\"source\":{\"fileType\":\"image\",\"reference\":{\"en\":\"bundle/images/new1.png\"}},\"widthStyle\":\"full\"},\"type\":\"media\"},{\"titleValue\":{\"alignment\":\"center\",\"subtitleConfig\":{\"fontSize\":17,\"text\":\"\",\"color\":\"#FFFFFF\"},\"titleConfig\":{\"fontSize\":22,\"text\":\"\"}},\"type\":\"title\"},{\"productListValue\":{\"items\":[{\"productId\":\"exampleapp.oneWeek\",\"promoText\":\"paywall.promo-1.title\",\"backgroundColor\":\"#0B867D\"},{\"discountRate\":80,\"productId\":\"exampleapp.oneYear\",\"promoText\":\"paywall.promo-2.title\",\"backgroundColor\":\"#0B867D\"}],\"layout\":\"vertical\"},\"type\":\"productList\"}],\"defaultProductId\":\"exampleapp.oneWeek\",\"footer\":{\"singleProductValue\":{\"customTitles\":{\"exampleapp.oneWeek\":\"Subscribe\",\"exampleapp.oneYear\":\"Subscribe\"},\"productId\":\"exampleapp.oneWeek\"},\"type\":\"singleProduct\"},\"id\":\"exampleapp\",\"isFullScreen\":true,\"settings\":{\"backgroundColor\":\"#000000\",\"closeButtonAlignment\":\"left\",\"closeButtonIconStyle\":\"light\",\"colorScheme\":{\"accent\":\"#007566\",\"background\":\"#001B0D\",\"label\":\"#FFFFFF\",\"primary\":\"#10C6B6\",\"secondaryLabel\":\"#FFFFFF\",\"seperator\":\"#FFFFFF\"},\"isFullScreen\":true,\"shouldShowAlertOnClose\":false,\"showCloseButtonAfter\":1,\"triggerPurchaseWithAlert\":false,\"triggerPurchaseWithProductChange\":false}}"
}
| Name | Type | Required | Description |
|---|---|---|---|
| lang | String | Yes | Locale code for the paywall localization. It uses language and region subtags separated by a hyphen (-). Examples: Refer to Localizations and locale codes for more details. |
| data | String | Yes | Serialized JSON string representing the remote config of your paywall. You can find it in the Remote Config tab of a specific paywall in the Adapty Dashboard. |
Subscription
Info about your end user subscription. You can do the following action via Adapty server-side API:
- Check the user’s current subscription by retrieving their profile details
- Set transaction to your user and grant a subscription to them
| Paramètre | Type | Requis | Nullable | Description |
|---|---|---|---|---|
| purchase_type | String | Oui | Non | Le type de produit acheté. Valeur possible : subscription. |
| store | String | Oui | Non | Store où le produit a été acheté. Options : app_store, play_store, stripe, ou l’ID du store de votre store personnalisé. |
| environment | String | Non | Non | Environnement dans lequel la transaction a eu lieu. Options : Sandbox ou Production. Production est utilisé par défaut. |
| store_product_id | String | Oui | Non | ID du produit dans le store (App Store, Google Play, Stripe, etc.) qui a déverrouillé ce niveau d’accès. |
| store_transaction_id | String | Oui | Non | ID de transaction dans le store (App Store, Google Play, Stripe, etc.). |
| store_original_transaction_id | String | Oui | Non | Pour les abonnements, cet ID est lié à la première transaction d’une chaîne de renouvellements. Chaque renouvellement est associé à cette transaction d’origine. S’il n’y a pas de renouvellement, |
| offer | Object | Non | Oui | L’offre utilisée lors de l’achat, fournie sous forme d’objet Offer. |
| is_family_shared | Boolean | Non | Non | Valeur booléenne indiquant si le produit prend en charge le partage familial dans App Store Connect. iOS uniquement. Toujours false pour iOS en dessous de 14.0 et macOS en dessous de 11.0. false est utilisé par défaut. |
| price | Object | Oui | Non | Prix de l’abonnement ou de l’achat sous forme d’objet Price. Un premier achat d’abonnement à coût zéro est un essai gratuit ; un renouvellement à coût zéro est un renouvellement gratuit. |
| purchased_at | ISO 8601 date | Oui | Non | La date et l’heure du dernier achat du niveau d’accès. |
| refunded_at | ISO 8601 date | Non | Non | La date et l’heure du remboursement de l’abonnement, le cas échéant. |
| cancellation_reason | String | Non | Non | Raisons possibles d’annulation : voluntarily_cancelled, billing_error, price_increase, product_was_not_available, refund, upgraded, ou unknown. |
| variation_id | String | Non | Non | L’ID de variante utilisé pour relier les achats au paywall spécifique depuis lequel ils ont été effectués. |
| originally_purchased_at | ISO 8601 date | Oui | Non | Pour les chaînes d’abonnements, il s’agit de la date d’achat de la transaction d’origine, liée par store_original_transaction_id. |
| expires_at | ISO 8601 date | Oui | Non | La date et l’heure d’expiration du niveau d’accès. Elle peut être dans le passé et null pour un accès à vie. |
| renew_status | Boolean | Oui | Non | Indique si le renouvellement automatique est activé pour l’abonnement. |
| renew_status_changed_at | ISO 8601 date | Non | Non | La date et l’heure à laquelle le renouvellement automatique a été activé ou désactivé. |
| billing_issue_detected_at | ISO 8601 date | Non | Non | La date et l’heure à laquelle un problème de facturation a été détecté (par ex. un échec de débit de carte). L’abonnement peut être encore actif. Cette valeur est effacée si le paiement aboutit. |
| grace_period_expires_at | ISO 8601 date | Non | Non | La date et l’heure à laquelle le délai de grâce prend fin si l’abonnement est actuellement dans cette période. |
Although the SDK includes the is_active parameter to check if a subscription is active, the server-side API does not provide this parameter. However, you can determine subscription status at any time by checking whether the current date falls between the starts_at and expires_at parameters of the Access Level object.