In-app purchase (IAP) and subscription revenue solution

Premium

At a glance: Automatically validate and measure revenue from in-app purchases and auto-renewable subscriptions to get the full picture of your customers' life cycles and accurate ROAS measurements.

Overview

Advertisers can use validated in-app purchases (IAP) and subscription revenue to measure:

  • All revenue from in-app purchases of products and subscriptions managed through either App Store Connect (iOS) or Google Play Console (Android).
  • Refunds.
  • Pending and deferred transaction revenue (Android).
  • Subscription-related events that happen inside or outside your app.

The IAP and subscription revenue solution also:

  • Makes sure no duplicate transactions are recorded. For iOS, this also can also ensure that no duplications are recorded for family sharing.
  • Allows AppsFlyer to forward Apple App Store transactions to the advertiser.
  • Provides True Revenue data, meaning net revenue data that takes into account store commission and taxes.

The purchase and subscription data originates from:

  • The AppsFlyer purchase SDK connector for Android and iOS (Unity wrapper included).
  • App Store and Google Play (RTDN) server notifications sent to AppsFlyer.

Purchase and subscription revenue data is available via AppsFlyer dashboards and reports. They can also be shared with partners via postbacks.

Considerations:

  • If you use this IAP and subscription revenue measurement solution, you shouldn’t send in-app purchases events or execute validateAndLogInAppPurchase, as doing so results in duplicate revenue being reported.
  • Subscription revenue is able to start recording subscriber life cycle changes for existing subscribers as soon as they launch an app version that includes the purchase SDK connector.

Flow:

  1. A user makes an in-app purchase or auto-renewable subscription.
  2. The app makes a transaction in the app store.
  3. The AppsFlyer purchase SDK connector automatically detects the purchase and sends its payload to AppsFlyer for validation and logging.
  4. AppsFlyer validates the purchase with the relevant store to ensure it's not fraudulent.
    • Upon successful validation, AppsFlyer logs the purchase or subscription.
    • If receipt validation fails, the event displays in the blocked in-app events raw data report (available to Protect360 subscribers). 
  5. AppsFlyer transfers the response to the SDK connector, which in turn transfers the receipt validation response (success or fail) to the app.
  6. Any incoming server notifications are also processed by the AppsFlyer purchase and subscription revenue business logic.
    • Notifications regarding transactions previously reported via the SDK connector are validated and processed, and result in the internal creation of a purchase or life cycle event.
    • Notifications regarding unknown transactions are dropped.
    • For iOS, all server notifications can be rerouted to your own servers.

Setup

Precisely follow the order of the setup instructions listed in the table below to ensure optimal accuracy and complete reporting of IAP and auto-renewable subscription revenue and life cycle events. Failing to do so can result in permanent reporting inaccuracies.

Details regarding each step are in the sections that follow.

Step Tasks
1

Set up server notifications for IAP and subscription revenue for Android and iOS.

2
  • Integrate the AppsFlyer purchase SDK connector for Android and iOS.
  • Recommended for subscription app owners: To identify your subscriber base faster, have server notifications set up before releasing your app version with the SDK connector.
3

Integrate the True Revenue tax API.

4

Test the integration to ensure:

  • The SDK connector is properly integrated.
  • Server notifications are properly configured and received by AppsFlyer.
5

Release the Android and iOS app versions with the purchase SDK connectors.

Set up server notifications for Android

Before you start:

  • Setting up IAP and subscription revenue consists of steps performed in Google Cloud Platform, and in the AppsFlyer UI. We recommend you keep tabs to Google Cloud Platform and AppsFlyer open throughout the setup.
  • Setup in the AppsFlyer UI requires admin permissions.

admin.png To configure IAP and subscription revenue:

  1. In Google Cloud Platform, go to Service Accounts, and click Create service account.
  2. Enter a service account name.
  3. Click Create and continue.
  4. For Role, select Pub/sub subscriber.
  5. Click Continue > Done.
  6. In Google Cloud Platform, go to Service Accounts, find the relevant service account, and click Actions > Manage keys.
  7. Click ADD KEY > Create new key.
  8. For Key type, select JSON.
  9. Click Create.
    The Google service account private key JSON is downloaded.
  10. In Google Play Console, go to Setup > API access.
  11. In the Service accounts list, find the relevant service account, and click Grant permissions.
  12. In the Permissions section, go to Account permissions, and select both:
    • View financial data.
    • Manage orders and subscriptions.
  13. Click Invite user > Send invite.
  14. In AppsFlyer, go to Integration > Revenue > Purchases & subscriptions.
    The Revenue configuration page opens.
    ARS_-_VIAP_Google.png
  15. In the Purchases and subscriptions section, upload your Google service account private key JSON.
  16. Select the method used to receive IAP and subscription revenue data from Google. Either:
    • Allow AppsFlyer to get RTDN messages directly from Google.
      1. Copy the AppsFlyer topic.
      2. In Google Play Console, select your app.
        The dashboard opens.
      3. Go to Monetization setup, and in the Google Play Billing section, in the Topic name field, paste the AppsFlyer topic that you recorded in substep 1.
      4. Click Save.
    • Forward your RTDN messages to AppsFlyer.
      1. Copy the AppsFlyer topic.
      2. In Google Cloud Platform, under Pub/Sub, go to the Topics section, and verify you have a dedicated pub/sub topic for subscriptions.
      3. In Google Cloud Platform, under Pub/Sub, go to the Subscriptions section, and click Create subscription.
      4. Enter a Subscription ID (name).
      5. Select the relevant subscription pub/sub topic from the dropdown.
      6. For Delivery type, select Push.
      7. Enter the endpoint URL (AppsFlyer topic) that you recorded in substep 1.
      8. For Expiration period, select Never expire.
      9. Leave everything else as is.
      10. Click Save.
      11. In Google Cloud Platform, under Pub/Sub, go to the Subscriptions section, and copy the topic name.
      12. In Google Play Console, go to Monetization setup, and in the Google Play Billing section, in the Topic name field, paste the topic name that you copied in substep 11.
      13. Click Save.
  17. In the AppsFlyer IAP and subscription revenue configuration page, turn on either or both:
    • Attribute and report auto-renewable subscriptions.
    • Validate purchases with Google Play.
  18. [Optional] Check Allow AppsFlyer to deduplicate transactions that were already reported. This ensures no duplicate transactions are recorded.
  19. Click Save.
    Note: It can take time (sometimes even 24 hours) after setting service account credentials and permissions to be able to use them. This may cause you to receive errors when trying to connect to Google RTDN.

Set up server notifications for iOS

Before you start:

  • Setting up IAP and subscription revenue consists of steps performed in App Store Connect and in the AppsFlyer UI. Keep tabs to both App Store Connect and AppsFlyer open during setup.

  • Setup in the AppsFlyer UI requires admin permissions.

admin.pngTo configure IAP and subscription revenue:

  1. In App Store Connect, go to Features > Subscriptions, and click Manage to get the App Store Connect shared secret key.
    app_store_connect_shared_secret.png
  2. In AppsFlyer, go to Integration > Revenue > Purchases & subscriptions.
    The Revenue configuration page opens.
    ARS-VIAP.png
  3. Enter your App Store Connect shared secret key.
  4. Copy the AppsFlyer endpoint and enter it in your App Store Connect configuration:
    1. In App Store Connect, select your app.
    2. In the App Information section, scroll down to App Store Server Notifications, and paste the AppsFlyer endpoint in the Production Server URL and Sandbox Server URL fields.
      ASSN.png
    3. Click Save.
  5. [Optional] Select to send server notifications to your endpoint and enter your endpoint. 
  6. In the AppsFlyer IAP and subscription revenue configuration page, turn on either or both:
    • Attribute and report auto-renewable subscriptions.
    • Validate purchases with the Apple App Store.
  7. [Optional] Check Allow AppsFlyer to deduplicate transactions that were already reported.
    This ensures no duplicate transactions are recorded.
  8. [Optional] Check Deduplicate revenue for Family Sharing purchases.
    This ensures no duplicate revenue is recorded for family-sharing purchases. Revenue events for other family members include the parameter purchase_ownership_type=FAMILY_SHARED and display zero revenue.

Note:

  • Apple can only send server notifications to one endpoint.
  • Customers can send Apple server notifications from their backend directly to the notification endpoint URL, but the requests must be exactly as they're received from the App Store.

Integrate purchase SDK connector

To integrate the SDK connector:

  1. Tell your Android developer to integrate the AppsFlyer Android purchase SDK connector.
  2. Tell your iOS developer to integrate the AppsFlyer iOS purchase SDK connector. Note: For apps built using the Unity framework, see the Unity connector documentation.

Note: For apps built using the Unity framework, see the Unity connector documentation.

Integrate True Revenue tax API

True Revenue is a business logic layer built to serve the AppsFlyer in-app purchase and subscription revenue solution. It automatically calculates the net revenue value for each incoming transaction in real time and includes it in reports. To calculate geo-based tax rates, you need to set up the dedicated tax API. Learn more about True Revenue

To set up the tax API:

  1. Give your developer:
    • The API V2 token to use as the authorization key.
    • The parameters and values that contain information on what taxes to calculate, as outlined in the table that follows.
  2. Tell your developer to follow their tax API instructions to create tax rate rules.

Parameters and values to use in the API

Parameter Mandatory Remarks Record the value (for your developer to use)
tax_name Yes
  • Name appearing in the customer invoice that describes the specific type of tax. 
  • Example: Sales, VAT, GST
 
tax_rate Yes
  • Number up to 4 decimal places representing the tax percentage to be collected.
  • Example: 7.25
 
tax_exclusive No
  • Boolean parameter, either true or false.
  • False means tax is included in the overall revenue.
  • True means tax is in addition to the overall stated revenue. For example, in the USA or Canada, where the sticker price doesn't include sales tax.
  • Default is false.
 
country No  
subdivision No
  • For some countries, there can be an additional state/subdivision.
  • Handled according to ISO 3166-2 subdivision codes.
  • Must include the country code and subdivision code.
  • Example: US-CA
 
postal_code No
  • String of letters and/or numbers
  • Example: L4J8E3
 
deduction_order No
  • Enum, either 0, 1, or 2:
    • 0 means store commission is deducted first from the gross revenue and tax is deducted from the remaining amount.
    • 1 means tax is deducted first from the gross revenue and store commission is deducted remaining amount.
    • 2 means that both tax and store commission are deducted from the total revenue.
 

Test IAP and subscription revenue

You should validate the IAP and subscription revenue integrations in a sandbox environment and ensure that:

  • The SDK connector is properly integrated.
  • Server notifications are properly configured and received by AppsFlyer.

Considerations:

In a sandbox environment:

  • Only initial purchase events causes the SDK connector to produce an event that is recorded by AppsFlyer. An IAP event is called af_purchase_sandbox_sdk. A subscription event is called af_ars_sandbox_sdk.
  • All other purchase events are dropped, meaning the SDK connector doesn’t produce an event.
  • Incoming server notifications are only processed if the SDK connector first records the original transaction. In this case, an IAP event is produced called af_purchase_sandbox_s2s. A subscription event is produced called af_ars_sandbox_s2s.
  • An event isn’t produced for any server notification for which the SDK connector didn’t first record the original transaction.
  • For iOS, make sure that under App Store Server Notifications in App Store connect, the AppsFlyer endpoint is configured as your Sandbox Server URL.
    ASSN.png

To test IAP and subscription revenue:

  1. Tell your developers to follow their Android and iOS instructions and purchase a product in the test app.
    For testing subscription revenue in iOS, the purchase must be of a subscription product in a subscription group you didn't test yet.
  2. Verify the event displays in the AppsFlyer Activity dashboard. An IAP event is called af_purchase_sandbox_sdk. A subscription event is called af_ars_sandbox_sdk. These events include:
    • A revenue value of 0 (so as not to skew real AppsFlyer reports).
    • An af_sandbox_revenue parameter that includes the revenue value of the product purchased so you can ensure the correct revenue is reported.
  3. If you’re testing a subscription product, give some time for AppsFlyer to receive a server notification from. Usually this occurs within a few minutes after the initial purchase. 
  4. Verify an event displays in the AppsFlyer Activity dashboard. An auto-renewable subscription purchase is called af_ars_sandbox_s2s. The event includes:
    • A revenue value of 0 (so as not to skew real AppsFlyer reports).
    • An af_sandbox_revenue parameter that includes the revenue value of the product purchased so you can ensure the correct revenue is reported.

Release the app version with the SDK connector

Before your developer releases the new app version with the purchase SDK connector integrated, make sure that:

  • The in-app events you want to capture as an IAP or subscription aren't blocked by one of the Validation Rules you have configured in AppsFlyer.
  • Your developer should have any sandbox flags marked as false.
  • For iOS, make sure that under App Store Server Notifications in App Store connect, the AppsFlyer endpoint is configured as your Sandbox Server URL.
    ASSN.png

IAP-related events and parameters

The following sections display the IAP-related events that AppsFlyer measures, and the parameters that are recorded for each event. See the event parameter dictionary for an explanation of the included parameters.

All generated events:

  • Are considered S2S events.
  • Are accessible in raw data reports (as organic or non-organic in-app events).
  • Can be sent via postbacks to partners.
  • Can be used in SKAN Conversion Studio.

Note: Depending on the user device platform, some parameters aren't always populated for an in-app event.

Purchase (af_purchase)

Description

Recorded when a user makes a purchase.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • net_revenue_tax_name
  • net_revenue_tax_rate
  • net_revenue_tax_exclusive
  • net_revenue_country
  • net_revenue_subdivision
  • net_revenue_postal_code
  • net_revenue_factors

Purchase canceled (af_purchase_canceled)

Description

Recorded when a user cancels a purchase.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment

Purchase pending (af_purchase_pending)

Description

Recorded when a user makes a purchase but the payment isn't yet processed.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment

Refund (af_purchase_refund)

Description

Recorded when a purchase is refunded.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_discount_type
  • af_revenue_usd
  • af_revenue (included in the event when the revenue exceeds zero)
  • store_commission
  • net_revenue
  • net_revenue_factors
  • net_revenue_tax_name
  • net_revenue_tax_rate
  • net_revenue_tax_exclusive
  • net_revenue_country
  • net_revenue_subdivision
  • net_revenue_postal_code

Test purchase (af_purchase_sandbox_sdk)

Description

Recorded when testing a purchase recorded via SDK in sandbox environment.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_purchase_state
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id

Test purchase (af_purchase_sandbox_s2s)

Description

Recorded when testing a purchase reported via S2S in a sandbox environment.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_purchase_state
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id

Subscription-related events and parameters

The following sections display the subscription-related events that AppsFlyer measures, and the parameters that are recorded for each event. See the event parameter dictionary for an explanation of the included parameters.

All generated events:

  • Are considered S2S events.
  • Are accessible in raw data reports (as organic or non-organic in-app events).
  • Can be sent via postbacks to partners.
  • Can be used in SKAN Conversion Studio.

Note: Depending on the user device platform, some parameters aren't always populated for an in-app event.

Trial started (af_ars_trial_started)

Description

Recorded when a subscriber begins a trial period.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type

Trial canceled (af_ars_trial_canceled)

Description

Recorded when a subscriber cancels the automatic renewal of the subscription during the trial period. If a user doesn't restore the auto-renewal within the trial period, a churn event follows.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type

Trial churned (af_ars_trial_churned)

Description

Recorded when a subscriber churns following a trial period. This happens after auto-renewal cancelation and trial period expiration. It can also follow a billing or technical issue with the renewal leading to churn.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_reason

Trial converted (af_ars_trial_converted)

Description

Recorded when a fully priced renewal starts, following a trial period. 

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_discount_id
  • af_discount_type
  • af_revenue_usd
  • af_revenue (included in the event only when the revenue exceeds zero.) 
  • store_commission
  • net_revenue
  • net_revenue_factors
  • net_revenue_tax_name
  • net_revenue_tax_rate
  • net_revenue_tax_exclusive
  • net_revenue_country
  • net_revenue_subdivision
  • net_revenue_postal_code

Subscription started (af_ars_subscription_started)

Description

Recorded when a discounted or a fully priced subscription starts.

Note:

  • New subscriptions can only be recorded via the SDK connector.
  • For iOS, if a subscriber repurchases a subscription they already own, the SDK connector reports a successful receipt validation back to the app, but doesn't record a new transaction in AppsFlyer.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_discount_id
  • af_discount_type
  • af_revenue_usd
  • af_revenue (included in the event when the revenue exceeds zero)
  • store_commission
  • net_revenue
  • net_revenue_factors
  • net_revenue_tax_name
  • net_revenue_tax_rate
  • net_revenue_tax_exclusive
  • net_revenue_country
  • net_revenue_subdivision
  • net_revenue_postal_code

Subscription canceled (af_ars_subscription_canceled)

Description

Recorded when an auto-renewal subscription is canceled in the middle of a billing period. If a user doesn't restore the auto-renewal within the same billing period, a churn event follows.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type

Subscription paused (af_ars_subscription_paused) - Android only

Description

Recorded when a user pauses an active subscription.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type

Subscription resumed (af_ars_subscription_resumed)

Description

Recorded when a fully priced subscription is resumed following a churned or refunded subscription.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_discount_id
  • af_discount_type
  • af_reason
  • af_revenue (included in the event when event revenue exceeds zero)
  • store_commission
  • net_revenue
  • net_revenue_factors

Subscription churned (af_ars_subscription_churned)

Description

Recorded when a subscriber churns. This usually happens after auto-renewal cancelation or billing period expiration. It can also follow a billing or technical issue, with the renewal leading to churn.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_reason

Subscription refunded (af_ars_subscription_refunded)

Description

Recorded when a subscriber is issued a refund.

Note:

  • This event is usually generated along with a negative value. In cases where it is impossible to detect which transactions were refunded, or details of the refund aren't included in the notification, the refund event shows no value.

Parameters 

  • app_id
  • customer_user_id
  • af_reason
  • af_subscription_ownership_type
  • af_discount_id
  • af_discount_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_refunded_transaction_ids
  • af_revenue_usd
  • af_revenue (included in the event when the revenue exceeds zero)
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_store
  • af_environment
  • af_period_type
  • store_commission
  • net_revenue
  • net_revenue_factors
  • net_revenue_tax_name
  • net_revenue_tax_rate
  • net_revenue_tax_exclusive
  • net_revenue_country
  • net_revenue_subdivision
  • net_revenue_postal_code

Subscription billing grace (af_ars_subscription_billing_grace)

Description

Recorded when a subscription renewal fails due to a billing issue and the subscriber enters the billing grace period.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • Af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • Af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type

Subscription renewed (af_ars_subscription_renewed)

Description

Recorded when an auto-renewal subscription takes place.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_discount_id
  • af_discount_type
  • af_revenue_usd
  • af_revenue (included in the event when the revenue exceeds zero)
  • store_commission
  • net_revenue
  • net_revenue_factors

Subscription changed (af_ars_subscription_xgraded)

Description

Recorded when a subscriber upgrades, downgrades, or cross-grades to a different product.

Parameters 

  • app_id
  • customer_user_id
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_discount_id
  • af_discount_type
  • af_revenue_usd
  • af_revenue (included in the event when the revenue exceeds zero)
  • store_commission
  • net_revenue
  • net_revenue_factors

Existing subscriber (af_ars_existing_subscriber)

Description

Recorded when the SDK connector is notified about a subscriber in the middle of a billing cycle, before getting a follow-up server notification that transitions the subscriber to another relevant lifecycle stage. This event is usually generated during your onboarding and SDK connector adoption period.

Parameters 

  • app_id
  • customer_user_id
  • country
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_cuids
  • af_validated

Test purchase (af_ars_sandbox_sdk)

Description

Recorded when testing a purchase recorded via SDK in sandbox environment.

Parameters 

  • app_id
  • customer_user_id
  • country
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_discount_id
  • af_discount_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_cuids
  • af_validated

Test purchase (af_ars_sandbox_s2s)

Description

Recorded when testing a purchase reported via S2S in a sandbox environment.

Parameters 

  • app_id
  • customer_user_id
  • country
  • af_currency
  • af_expires_date_ms
  • af_subscription_ownership_type
  • af_discount_id
  • af_discount_type
  • af_original_transaction_id
  • af_order_id
  • af_purchase_token
  • af_transaction_id
  • af_product_id
  • android_id
  • idfa
  • ip
  • appsflyer_id
  • af_purchase_date_ms
  • af_store
  • af_environment
  • af_period_type
  • af_cuids
  • af_validated

Parameter dictionary

Parameters for IAP and subscription events display in raw data reports either as their own columns or populated as part of the Event value.

The parameters that have their own columns are:

  • app_id
  • customer_user_id
  • country_code
  • af_currency
  • af_revenue_usd
  • af_revenue
  • android_id
  • ip
  • idfa
  • appsflyer_id

See the data fields dictionary for more details about these parameters.

The following table describes the raw data parameters available in ARS and VIAP events.

Parameter Remarks Product
af_cancelation_date_ms Date of the cancelation IAP
af_reason
  • In cancelation or churn-related events, the reason a user churned or canceled. Possible values:
    • iOS:
      • cancel_intent
      • billing_issue
      • declined_price_increase
      • product_unavailable
    • Android:
      • I don't use this service enough
      • Technical issues
      • Cost-related reasons
      • I found a better app
      • Other
  • In subscription resumed events, the reason a user resumed their subscription. Possible values:
    • Android:
      • paused and resumed
      • disabled and enabled auto-renew
  • In refund-related events, the reason why the user received a refund. Possible values:
    • iOS:
      • 1: issue with your app
      • 0: another reason
  • IAP
  • Subscription
af_expires_date_ms

The expiration date of the current subscription billing cycle

Subscription

af_subscription_ownership_type

FAMILY_SHARED means the user has access via family sharing.  PURCHASED means the paying user made the purchase.

Subscription

af_discount_id

The offer ID presented to the user during the initial purchase. The ID is populated only when there is a discount code.

  • IAP
  • Subscription
af_discount_type

The discount type redeemed by the user. Possible values:

  • IOS
    • introductory
    • subscription
  • Android
    • intro price
    • one_time_code
    • vanity_code
Subscription
af_original_transaction_id
  • The original transaction ID
  • iOS only
  • IAP
  • Subscription
af_order_id
  • The order ID for the transaction
  • Android only
  • IAP
  • Subscription
af_purchase_token
  • The purchase token for the transaction
  • Android only
  • IAP
  • Subscription
af_transaction_id
  • The ID of the transaction
  • iOS only
  • IAP
  • Subscription
af_purchase_state

Possible values:

  • Purchased
  • Canceled
  • Pending

IAP 

af_original_transaction_id
  • The original ID of the transaction
  • iOS only
  • IAP
  • Subscription
af_refunded_transaction_ids
  • An array of all refunded transaction IDs
  • iOS only
  • IAP
  • Subscription
af_product_id

The subscription product ID

  • IAP
  • Subscription
af_purchase_date_ms

The purchase date for the reported product ID in-app event

  • IAP
  • Subscription
af_store

The app store the subscription product was purchased from

  • IAP
  • Subscription
af_environment

The environment from which data is received, either production or sandbox.

  • IAP
  • Subscription
af_period_type
  • Subscription or trial period type.
  • Possible values:
    • trial
    • intro
    • normal

Subscription

store_commission
  • The calculated percentage of commission the store gets from the purchased product.
  • Displayed as a decimal.
  • Example: 30
  • IAP
  • Subscription
net_revenue

Net revenue calculated based on all factored reasons. See net_revenue_factors.

  • IAP
  • Subscription
net_revenue_factors
  • An array representing all factored reasons that produce the reported net_revenue amount.
  • Example value: store_commission
  • IAP
  • Subscription

net_revenue_tax_name

  • Name appearing in the customer invoice that describes the specific type of tax. 
  • Example: Sales, VAT, GST
  • IAP
  • Subscription

net_revenue_tax_rate

  • Number up to 4 decimal places representing the tax percentage collected.
  • Example: 7.25
  • IAP
  • Subscription

net_revenue_tax_exclusive

  • Boolean parameter, either true or false.
  • False means tax is included in the overall revenue.
  • True means tax is in addition to the overall stated revenue. For example, in the USA or Canada, where the sticker price doesn't include sales tax.
  • IAP
  • Subscription

net_revenue_country

  • IAP
  • Subscription

net_revenue_subdivision

  • For some countries, there can be an additional state/subdivision. This is handled according to ISO 3166-2 subdivision codes.
  • Includes the country code and subdivision code.
  • Example: US-CA
  • IAP
  • Subscription

net_revenue_postal_code

  • String of letters and/or numbers
  • Example: L4J8E3
  • IAP
  • Subscription
af_cuids
  • In the context of ARS, this parameter contains an array with all CUIDs.
  • The array of CUIDs displays irrespective of the device IDs. Thus, the same CUIDs can display for more than one device ID.
Subscription

Additional information

True Revenue

True Revenue is a business logic layer built to serve the AppsFlyer in-app purchase and subscription revenue solution. It automatically calculates the net revenue value for each incoming transaction in real time and includes it in reports. True Revenue considers the following factors in the gross-to-net revenue calculation: 

  • Store commission:
    • Is calculated and reported automatically. No action on your part is required.
    • For subscriptions are automatically calculated on a per-subscriber basis, taking into account the lifetime of the subscriber, starting at 30% commission, and reducing to 15% after 1 year.
    • Related net revenue parameters are available in raw data reports.
  • Tax: Reported after you set up the dedicated tax API which sets the tax rates based on geo to be calculated on incoming transactions.

When viewing True Revenue in reports, the following parameters contain the net revenue data. See the parameter dictionary for more details.

Parameter Net revenue factor

store_commission

Store commission

net_revenue_tax_name

Tax

net_revenue_tax_rate

Tax

net_revenue_tax_exclusive

Tax

net_revenue_country

Tax

net_revenue_subdivision

Tax

net_revenue_postal_code

Tax
net_revenue
  • Store commission
  • Tax
net_revenue_factors
  • Store commission
  • Tax

Traits and limitations

Trait Product Remarks
Google billing libraries V5
  • IAP
  • Subscription revenue
Not supported
New subscriptions

Subscription revenue

Only recorded via the AppsFlyer purchase SDK
Price change

Subscription revenue

If subscription revenue doesn't receive an SDK-originated notification with the new product price, subscription revenue continues to report the previous product price as revenue. Once the new product price is received from the purchase SDK, the new price is recorded.
Gross revenue
  • IAP
  • Subscription revenue
Supported
Net revenue
  • IAP
  • Subscription revenue
Supported in raw data only
Tax

Subscription revenue

Supported
Net revenue store commission
  • IAP
  • Subscription revenue
  • 15% for subscribers older than 1 year: Supported in raw data only
  • Small business programs: Not supported
Refunds IAP Can be reported until 180 days after the original purchase
Deduplication
  • IAP
  • Subscription revenue
Supported for transactions reported up to 180 days after event date