# In-App purchases and subscriptions — instructions for the developer Relevance: October 7, 2026. Task: connect the transfer of purchases and subscription changes agreed with the analyst, separate test events, and check the result. ## For the developer — purchases and transfer verification ### Choose a collection method 1. Make sure the AppMetrica SDK is connected and activated. Determine which payments come through stores and which through your system. 2. For automatic purchase collection, StoreKit on iOS and Google Play Billing on Android are used. Enable the corresponding SDK setting: `revenueAutoTrackingEnabled` on iOS or `withRevenueAutoTrackingEnabled` on Android. 3. For manual sending, transfer In-App Revenue using your platform's SDK. Instructions: [Android](https://appmetrica.yandex.ru/docs/en/sdk/android/analytics/android-operations#send-revenue), [iOS](https://appmetrica.yandex.ru/docs/en/sdk/ios/analytics/ios-operations#send-revenue), [Flutter](https://appmetrica.yandex.ru/docs/en/sdk/flutter/analytics/flutter-operations#send-revenue), [React Native](https://appmetrica.yandex.ru/docs/en/sdk/react-native/analytics/react-native-operations#send-revenue), [Unity](https://appmetrica.yandex.ru/docs/en/sdk/unity/analytics/unity-operations#send-revenue). 4. If the information comes from the server, use [In-App Revenue upload via the Post API](https://appmetrica.yandex.ru/docs/en/mobile-api/post/post-revenue). This method is suitable for your own payment system and your own subscription logic. 5. For subscriptions, separately configure status retrieval according to the Google Play and App Store instructions below. An automatically received first purchase doesn't mean that all renewals and cancellations are already tracked. ### Transfer via the Post API 1. Get the Post API key in **Settings → General**. Use different keys for the test and production environments. 2. Prepare the event parameters according to the [method](https://appmetrica.yandex.ru/docs/en/mobile-api/post/post-revenue) description. Check the [specifics](https://appmetrica.yandex.ru/docs/en/mobile-api/post/about) and [restrictions](https://appmetrica.yandex.ru/docs/en/mobile-api/post/restrictions). 3. Send the event via `/logs/v1/import/revenue` or a CSV batch via `/logs/v1/import/revenue.csv`. Historical events can only be uploaded for the last 14 days. 4. Check the API response and the appearance of the event in the report. Fix authorization and required parameter errors before resending. ### Purchase verification Validation confirms the fact of payment and helps identify purchases from hacked apps. Add the required keys in the Revenue settings and transfer the information for validation according to the SDK documentation of the selected platform. When validation is enabled, the revenue metrics include purchases that passed verification, as well as purchases sent without parameters for verification. For purchases that didn't pass verification, separate metrics "Invalid revenue" and "Users with invalid revenue" are used. Therefore, the presence of a purchase in regular revenue by itself doesn't mean it was verified. ### Testing and duplicates For test events, use a separate API key; when sending via the SDK, use a reporter. In AppMetrica, you can't separate test events from production ones if they have already been sent to one main API key. [Android reporter](https://appmetrica.yandex.ru/docs/en/sdk/android/analytics/android-operations#reporter-different-apikey), [iOS reporter](https://appmetrica.yandex.ru/docs/en/sdk/ios/analytics/ios-operations#reporter-different-apikey). Check the product, amount, currency, and number of purchases. If manual and automatic collection are enabled simultaneously, check for double counting and the choice of sources in **Settings → Revenue**. This setting changes the display, including past periods, but doesn't stop event collection. ## For the developer — Google Play subscriptions Connect a service account and a Google notification channel so that AppMetrica can receive subscription changes. You'll need access to Google Cloud, Google Play Console, and the app settings in AppMetrica. ### Create a service account 1. Open or create a project in [Google Cloud](https://console.cloud.google.com/cloud-resource-manager). 2. Find **Service accounts**, click **Create service account**, and set the account name. 3. Assign the role **Basic → Editor** according to the current AppMetrica instructions. 4. In the **Actions → Manage keys** menu, select **Add key → Create new key**, type **JSON**. Save the key file for uploading to AppMetrica. ### Grant access to the app 1. Open [Users and permissions](https://play.google.com/console/users-and-permissions?hl=en) in Google Play Console and click **Invite new users**. 2. Specify the email of the created service account. 3. On the **Account permissions** tab, enable: **View app information and download bulk reports (read-only)**; **View financial data, orders, and cancellation survey responses**; **Manage orders and subscriptions**. 4. On the **App permissions** tab, select the required app via **Add app**, then **Invite user → Send Invite**. 5. In AppMetrica, open **Settings → Revenue → Google Play subscription tracking and validation** and upload the service account JSON file. ### Connect change notifications A Cloud Pub/Sub topic is a channel through which Google sends messages about subscription changes. In AppMetrica, choose the appropriate option. - **Create a new topic.** Suitable if other services don't yet receive notifications. Copy the name of the created topic and paste it into **Google Play Console → Monetization setup → Topic name**. - **Use an existing topic.** If it's already configured for another service, copy the name from **Google Play Console → Monetization setup → Topic name** into the Revenue settings in AppMetrica. An app can't have two topics specified simultaneously in Google Play Console. - **Don't use a topic.** Not recommended: AppMetrica will check statuses once a day, data may be delayed up to 24 hours, and some events will be unavailable. Make sure the topic exists and Google can publish notifications to it. Check the permissions according to the [Google documentation](https://developer.android.com/google/play/billing/getting-ready#configure-rtdn). Save the settings and enable tracking in AppMetrica. ### If a Pub/Sub error occurs The error `PERMISSION_DENIED: Cloud Pub/Sub API has not been used in project before or it is disabled` means that the Pub/Sub API isn't enabled in the project. Follow the link from the error message, click **Enable**, then return to AppMetrica and click **Save and enable tracking** again. ### Check the result Run a Google Play test scenario and check the required status changes in the report. Compare not only the first purchase, but also the renewal, cancellation, and end of the subscription. Consider the selected notification method. ## For the developer — App Store subscriptions To check statuses, AppMetrica uses the App Store Shared Secret, and to receive changes, App Store Server Notifications. You'll need access to App Store Connect and the app settings in AppMetrica. ### Add a Shared Secret Shared Secret is an app key that AppMetrica uses to verify a purchase and subscription status. 1. In [App Store Connect](https://appstoreconnect.apple.com/apps), open **Apps** and select the app. 2. Go to **Features → Subscriptions**. 3. In the **App-Specific Shared Secret** section, click **Manage**, create and copy the key. 4. In AppMetrica, open **Settings → Revenue** and paste the key into the **App Store Shared Secret** field. ### Connect server notifications 1. Copy the notification address from **Settings → Revenue** in AppMetrica: `https://apple.inapp.appmetrica.yandex.net`. 2. In App Store Connect, select the app and open **General → App Information**. 3. In the **App Store Server Notifications** block, next to **Production Server URL**, click **Edit**. 4. Paste the AppMetrica address, select **Version 2 Notifications**, and click **Save**. If server notifications aren't connected, information may arrive with a delay of up to 24 hours, and some events will be unavailable. Consider this if notifications are already directed to another service. ### Check the result Run a store test scenario and make sure the required events arrive in AppMetrica. Distinguish between auto-renewal cancellation and the end of paid access. Check the amounts, currency, product, and the absence of double payment counting. ## For the developer — manual sending of subscription data If subscriptions don't go through Google Play or App Store, or you track subscriptions yourself, use In-App Revenue upload via the Post API. This method is suitable for your own payment system and your own subscription logic. Specify the event type in the required revenue_event_type field. For example, pass subscription_started when a subscription is issued without an introductory offer, subscription_renewed on renewal, and cancellation on cancellation. Note. Revenue events uploaded via the Post API don't undergo validation and are always considered valid.