[Closed beta ] In-app purchases (IAP)

beta_feature.png

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

In-app purchase overview

Advertisers can use validated in-app purchases to validate and measure:

  • All revenue from in-app purchases.
  • Refunds (for iOS).
  • Pending and deferred transactions revenue (Android).

IAP also:

  • Makes sure no duplicate transactions are recorded. For iOS this also ensures no duplications are recorded for family sharing.
  • Allows AppsFlyer to forward Apple App Store transactions to the advertiser.

IAP revenue data is available via AppsFlyer dashboards and reports.

Note: IAP doesn't include revenue from subscriptions. Learn more about auto-renewable subscription (ARS) revenue.

Flow

The IAP flow is as follows:

  1. The user performs an in-app purchase.
  2. The app store notifies the app of the successful purchase.
  3. The AppsFlyer IAP 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 make sure it is not fraudulent.
  5. Upon success, AppsFlyer internally creates a regular af_purchase event. Otherwise, the created event is tagged as fraudulent (available via Protect360). 
  6. The AppsFlyer IAP service transfers the response to the SDK connector.
  7. The SDK connector transfers the receipt validation response to the app (either success or fail).
    If receipt validation fails, the event displays in the blocked in-app events raw-data report (available to Protect360 subscribers).

AppsFlyer IAP setup

Scope of work
Who's involved Tasks
Marketer
  • Configures IAP in AppsFlyer for Android.
  • Configures IAP in AppsFlyer for iOS.
Android developer Integrates the AppsFlyer Android IAP SDK connector.
iOS developer Integrates the AppsFlyer iOS IAP SDK connector.

Configure IAP for Android

To configure IAP for Android:

  1. In Google Cloud Platform:
    1. Create a Google service account.
    2. Create a service account key JSON.
    3. Give the service account permission to view financial data. Select:
      • View financial data, orders, and cancellation survey responses.
      • Manage orders and subscriptions.
  2. In AppsFlyer, go to Configurations > Subscription Attribution> Purchases & subscriptions.
  3. Upload the JSON of your Google service account private key.
  4. In the Purchases section, turn on Validate purchases with Google Play.
  5. [Optional] Check Allow AppsFlyer to deduplicate transactions that were already reported.
    This ensures no duplicate transactions are recorded.
  6. Click Save.

Configure IAP for iOS

To configure IAP for Android:

  1. In App Store Connect, create a shared secret key:
    1. Log in to your App Store Connect account.
    2. Click Apps and select the app.
    3. Select Manage under the In-App Purchases section on the left side menu.
    4. Click the App-Specific Shared Secret label on the right.
    5. Generate and copy your shared secret key.

  2. In AppsFlyer, go to Configurations > Subscription Attribution > Purchases & subscriptions.
  3. Enter your App Store Connect shared secret key.
  4. In the Purchases section, turn on Validate purchases with the Apple App Store.
  5. [Optional] Check Allow AppsFlyer to deduplicate transactions that were already reported.
    This ensures no duplicate transactions are recorded.
  6. [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.
  7. Click Save.

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.

Note: All parameters apply to Android and iOS unless otherwise stated

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

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
  • store_commission
  • net_revenue
  • net_revenue_factors

Event parameter dictionary

Parameter Remarks
app_id

The app ID

customer_user_id

The customer user ID

af_cancellation_reason
  • The reason why the user received a refund:
    • 1: issue with your app
    • 0: other reason
  • iOS only
country_code

The country code

af_currency

The local currency of the transaction

af_original_transaction_id
  • The original transaction ID
  • iOS only
af_order_id
  • The order ID for the transaction
  • Android only
af_purchase_token
  • The purchase token for the transaction
  • Android only
af_transaction_id
  • The ID of the transaction
  • iOS only
af_refunded_transaction_ids An array of all refunded transaction IDs
iOS only
af_revenue_usd

The gross revenue reported in USD - based on the latest known product price

af_revenue

The gross revenue reported in the local currency based on the latest known product price

af_product_id

The purchase product ID

advertiser_id

The advertiser ID

idfa

iOS device identifier

ip

IP address

appsflyer_id

AppsFlyer user ID

purchase_date_ms

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

af_store

The app store the product was purchased from

af_environment

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

store_commission
  • The calculated percentage of commission the store gets from the purchased product.
  • Displayed as a decimal.
net_revenue

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

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

 

Traits and limitations

Traits and limitations
Trait Remarks
Google billing libraries V5 Not supported
Gross revenue Supported
Net revenue Supported in raw data only
Was this article helpful?