At a glance: Get basic receipt validation to measure revenue from in-app purchases and get accurate ROAS measurements. Contact your CSM to join the close beta.
About basic receipt validation
Advertisers can use basic receipt validation to validate and measure in-app purchases from Google Play and the App Store and get accurate ROAS measurements.
Basic receipt validation is free of charge to all account plans.
Note
Consider using ROI360 in-app purchases (IAP) and subscription revenue measurement to measure:
- All revenue from in-app purchases of products and subscriptions managed through either Google Play Console (Android) or App Store Connect (iOS).
- Refunds.
- Pending and deferred transaction revenue (Android).
- Subscription-related events that happen inside or outside your app (renewals, conversions from trial, cancelations, and more).
The ROI360 solution also:
- Makes sure no duplicate transactions are recorded. For iOS, this also ensures that no duplications are recorded for family sharing.
- Allows AppsFlyer to forward Apple App Store transactions to you (the advertiser).
- Provides True Revenue data, meaning net revenue data that takes into account store commission and taxes.
Basic receipt validation integration workflow
Precisely follow the order of the setup instructions listed in the table below to ensure optimal accuracy and reporting of purchase revenue. Failing to do so can result in permanent reporting inaccuracies. Full details for each step are included in the tabs following the table.
Step | Tasks |
---|---|
1 |
Generate the Google Play key for receipt validation. |
2 |
Generate the iOS App Store keys for receipt validation. |
3 |
Implement the validateAndLogInAppPurchase function in the AppsFlyer SDK for Android and iOS. Note: Calling this function generates an af_purchase in-app event. As such, don't generate an af_purchase event when validating. Doing so results in duplicate revenue events. |
4 |
Release the Android and iOS app versions with the validateAndLogInAppPurchase function. |
Step 1: Generate Google Play key for receipt validation
Before you start:
- Setting up basic receipt validation 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.
Follow the instructions in the tabs below to generate and upload the Google Play key:
1.1 Link your Google Play Developer Account to your Google Cloud Project
- In the Google Play Console, go to your Google Play Developer Account.
- Link the account to your Google Cloud project. For instructions, see this Google help topic.
- Enable the Google Play Developer API. For instructions, see this Google help topic.
1.2 Create service account
- Go to Google Cloud and open the project you just linked in 1.1.
- Under your project go to IAM and Admin > Service Accounts, and click Create service account.
- In the Create service account page complete the Service account details step. Remember the service account name; you'll need it in step 1.4.
- Click Create and continue.
- In the Grant this service account access to the project step, select the Pub/sub subscriber role.
- Click Continue > Done.
1.3 Download account private key.
- In the Service Accounts page, find the relevant service account, and click and than Manage keys.
- In the Keys tab of the service account page click ADD KEY > Create new key.
- In the Create private key dialog, select the JSON key type.
- Click Create. The private key JSON file is downloaded.
- In AppsFlyer, from the side menu, select Settings > Revenue Settings.
- Select your app from the list.
- In the Basic receipt validation tab, click to upload the JSON file.
1.4 Set API access permissions
- In the Google Play Console, go to Users and permissions.
- In the Users and permissions list, find the service account you created in 1.2, and click Manage.
- In the Permissions section, go to the Account permissions tab, and select both:
- View financial data.
- Manage orders and subscriptions.
- Click Invite user and then Send invitation.
1.5 Validate and configure Basic receipt validation
- In AppsFlyer, in the Basic receipt validation tab, click Validate key to make sure the JSON file you uploaded is correct.
Note:- After setting service account credentials and permissions, it can take up to 24 hours to be able to use them. This may cause you to receive errors when trying to validate the key or perform a validation test.
-
To work around this 24 hour wait time, in the Google Play Console, go to any application, navigate to Monetize > Products > Subscriptions/In-app products, and change something. For example, edit the description of your product and save it. This should instantly update the account credentials and permissions. You can then undo the changes.
- Turn on Validate purchases with Google Play.
- Click Save.
Step 2: Generate iOS App Store keys for receipt validation
Before you start:
-
Setting up basic receipt validation 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.
To configure basic purchase receipt validation:
- In App Store Connect, go to Apps and select the relevant apps.
- In App Store Connect, go to Users and Access > Keys and from the Key Type list, select App Store Connect API.
- Click + to generate an API key.
- Enter a name for your API key, and for Access, enter the role "Admin," "App manager," or "Developer".
- Click Generate.
- Click Download to download the API key. Note: You can only download the key once.
- In AppsFlyer, from the side menu, select Settings > Revenue Settings.
- Select your app from the list.
- In the Basic receipt validation tab, click to upload the p8 file.
- In App Store Connect, copy the Key ID of the key you just generated, and paste it in the AppsFlyer Basic receipt validation setting for Key ID.
- In App Store Connect, copy the Issuer ID, and paste it in the AppsFlyer Basic receipt validation setting for Issuer ID.
- In AppsFlyer Basic receipt validation settings, click Validate keys to make sure the keys you entered are correct.
- Turn on Validate purchases with the Apple App Store.
- Click Save.
Step 3: Implement validateAndLogInAppPurchase (Beta) function
Implementing the validateAndLogInAppPurchase
(Beta) function for iOS and Android enables your app to record in-app purchases made in Google Play and the App Store.
To integrate the function:
- Tell your Android developer to follow their AppsFlyer Android SDK instructions.
- Tell your iOS developer to integrate the AppsFlyer iOS SDK instructions.
Note: For apps built using the Unity framework, developers should refer to the Android and iOS SDK instructions.
Step 4: Release app version with validateAndLogInAppPurchase function
Before your developer releases the new app version with the validateAndLogInAppPurchase function implemented, make sure that:
- All previous steps have been completed.
- Any Sandbox parameters from the testing environment are removed.
- The in-app events you want to capture as purchases aren't blocked by one of the Validation Rules you may have configured in AppsFlyer.
Reference
In-app purchase event and parameters
Below you can read about the in-app purchase event and its parameters. See the event parameter dictionary for an explanation of the included parameters.
The event recorded for in-app purchases is: af_purchase
All purchase 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.
The event includes the following parameters:
- af_environment: Either sandbox or production (iOS only)
- af_validation_type: basic
- af_product_id
- af_transaction_id (iOS only)
- af_purchase_token (Android only)
- af_revenue
- af_currency
- af_validated: Either true or false
- af_store: Either app_store or google_play
- Other parameters provided by the developer in the request
- appsflyer_id
- customer_user_id
- advertising_id
- idfa
- idfv
- att
- os version
- app version
- ip
- geo
- custom data
Receipt validation flow
The receipt validation flow is as follows:
- The user performs an in-app purchase.
- The app store notifies the app of the successful purchase.
-
The app developer calls the SDK Basic receipt validation function:
validateAndLogInAppPurchaseInAppPurchase
- The SDK calls the AppsFlyer validation service.
- AppsFlyer validates the purchase to make sure it is not fraudulent.
- Upon success, AppsFlyer internally creates a regular af_purchase event. Otherwise, the created event is tagged as fraudulent (available via Protect360).
- The AppsFlyer validation service transfers the response to the SDK.
- The SDK 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).
Traits and limitations
Trait | Remarks |
---|---|
Supported stores |
|
iOS sandbox apps |
|