In App Purchase API

ironSource App Analytics provides analysis of the application revenue from in-app purchase. Analysis of the items available to purchase. Identify where the places the users purchase them and where those items are placed within the location that yield the best revenue. 

Analyzing the in-app purchase revenue within the application rely on two phases:

  • Settings API (Pre-init)
  • Purchases API (Post-init)

Settings API (Pre-init)

Use this API, prior to SDK initialization, to update the in-app purchase settings available in your application. Only settings declared prior to initialization are available for purchases updates

// In-app purchase settings API
IronSourceAnalytics.setIAPSettings(ISAnalyticsPurchasingType purchasingType, string[] values);


  • ISAnalyticsPurchasingType purchasingType – an enumeration of the required in-app purchase item to update. Available values:
    • PURCHASE_ITEMS – The official declared purchase items’ names that users can buy within the application (Such as 500 coins, a bundle of 1000 coins and 100 gems etc.)
      • Recommended to set according to the application unique offering IDs
    • ITEM_CATEGORIES – The categories / groups of items that can be purchased by users or places category (Promo pop up, Bundle in shop, Non depositors offerings etc.)
    • PURCHASE_PLACEMENTS – The places / locations where users can purchase items within the application (Such as Shop, between levels, Holiday promo pop up etc.)
  • string[] values – Array of string values paired with the required enum. Limited to 100 items per list (Per PurchasingType)

Note: All parameters are mandatory 

Example of in-app purchase settings API

// Example of in-app purchase settings prior to sdk initialization
// First, set all unique offering IDs, or items, that available in the application
string[] iapOffersIDs = new string[3];
         iapOffersIDs[0] = "coins_bundle_123";
         iapOffersIDs[1] = "gems_offer_10102020";
         iapOffersIDs[2] = "holiday_special_300_coins";
IronSourceAnalytics.setIAPSettings(ISAnalyticsPurchasingType.PURCHASE_ITEMS, iapOffersIDs);
// Example of adding the categories of the packages available in the application
string[] iapOfferingCategories = new string[3];
         iapOfferingCategories[0] = "non_depositors";
         iapOfferingCategories[1] = "holiday_promotion";
         iapOfferingCategories[2] = "begginers_pack";
IronSourceAnalytics.setIAPSettings(ISAnalyticsPurchasingType.ITEM_CATEGORIES, iapOfferingCategories);
// Example of adding the locations in the application for purchasing
string[] iapOfferingLocations = new string[4];
         iapOfferingLocations[0] = "out_of_coins_popup";
         iapOfferingLocations[1] = "shop_1";
         iapOfferingLocations[2] = "holiday_popup";
         iapOfferingLocations[3] = "between_levels_4_5";
IronSourceAnalytics.setIAPSettings(ISAnalyticsPurchasingType.PURCHASE_PLACEMENTS, iapOfferingLocations);

Purchases API (Post-init)

Use this API, following the SDK initialization, to update the users’ in-app purchases (Using the items, placements & categories that were set in the pre-init phase)

// The in-app purchase updates API
IronSourceAnalytics.updateUserPurchase(ISAnalyticsInAppPurchase appPurchase);


  • ISAnalyticsInAppPurchase appPurchase – The object that represents the purchase event

ISAnalyticsInAppPurchase Object

This object and it’s properties define all the required information regarding a purchasing event


  • ISAnalyticsInAppPurchase(string item) – The item that was purchased by the user. Must be one of the items declared in the setIAPSettings SDK API, in PURCHASE_ITEMS list

Set methods:

  • fromCategory(string name) – The category of the purchased item. Must be one of the item types declared in the setIAPSettings SDK API, in ITEM_CATEGORIES list
  • paid(float amount) – The amount of the money that was used for the purchase
  • currency(string name) – Currencies shall be chosen according to ISO 4217 format
  • purchasedPlacement(string name) – Must be one of the placements the developer passed part of setIAPSettings SDK API, in PURCHASE_PLACEMENTS list

Note: All methods must be set 

Example of in-app purchase update API

// Example of in-app purchase 
ISAnalyticsInAppPurchase coinsBundle123 = new ISAnalyticsInAppPurchase("coins_bundle_123")