Skip to content

In-App Purchase (IAP)

IdleKit's IAP framework is based off of the Unity's IAP.

Note

For platform-specific information:

StoreProductData

StoreProductData includes information about purchasable items that are available in the Store. StoreProductData is part of IdleKit Data, and it maps directly to Store (iOS, Android).

StoreProductData.ProductType is an enum and can be one of:

  • Consumable: Can be repurchased. e.g., in-game currencies
  • NonConsumable: Cannot be repurchased and are owned indefinitely. (e.g., custom avatars)
  • Subscription: Have a finite window of validity, can be repurchased once that window has ended. (e.g., no-ads)

    Depending on Product Type, purchasing items can have a different set of requirements/flows. (e.g., Unity documentation states that consumable item purchases need to return PurchaseProcessingResult.Pending instead of PurchaseProcessingResult.Complete.)

StoreProductData.StoreSku is also known as Product SKU. It maps directly to the Product SKU on platform stores.

Note

Be advised that Apple/Google store cannot communicate directly with datasheets. It is the developers' responsibility to make sure that the product information is consistent on both sides.

e.g. ProductSku and StoreSku on sheets needs to match with Product SKU on platform stores.

Purchasable

purchasable

Players can purchase purchasable items in the game through the PurchasingService. Any class that extends from IPurchasable would inherit ProductSku, RealCurrencyPrice and PurchasedItemsDataIds.

Generic IAP Data:

Generic IAP contains information about generic IAP items for sale in the Store. Generic items can be any type, such as: soft currency, cards, etc. - e.g., Purchasing soft currency in the game using real currency is a Generic IAP Purchase. GenericIAPData has fields:

  • id: Used for identifying generic purchases within IdleKit
  • Title: Title visible to player.
  • TitleLocalizationString: Localization Key for the title.
  • Description: Text shown in UI, describes the item.
  • DescriptionLocalizationString: Localization Key for the Descriptions.
  • ProductSKU: Maps to StoreSku in StoreProductData, as well as Product SKU on platform stores.
  • RealCurrencyPrice: Sale price player is charged for. It should match with the price listed on platform stores.
  • PurchasedItemDataIds: An array of item IDs associated with purchase. These items are normally a type of a Reward (inheriting from IReward) and they will be granted to the player upon successful transaction.
  • StoreImageUrl: Image that is displayed on the store.
  • DollarValue: Used for setting a secondary value for the item. It is optional and can be shown next to the RealCurrencyPrice on the store.
  • Platform: iOS or Android.
  • Enabled: Boolean. Is item available for purchase?
  • Localization: Key for the IdleKit localization system to determine which language this item should be shown in (if it's set).

e.g., An item with DollarValue = 10.99USD and RealCurrencyPrice = 5.99USD will be sold for 5.99USD to the player. Additionally, its price might be displayed as 10.99 5.99USD in-game to indicate a sale.

Note

Since Apple/Google store cannot communicate directly with datasheets, both DollarValue and RealCurrencyPrice are for display purposes only. The player will be charged for the amount specified on the platform stores.

Promo Data

Promo Data contains information about promo items for sale in the Store. Promo purchases can have triggers in the main game or during events. Anything can be sold as a promo purchase, and those items can have any ProductType. For more information about Promo or Promo Data fields, check out Promo Documentation

Purchasing Service

Idlekit Purchasing Service acts as a bridge between unity IAP and Apple/Google Play Store. This is an implementation of the flow at unity manuals.

Unity Manual Processing Purchases

purchasingserviceflowchart

Receipt Validation

ESG Game Services conduct receipt Validation. For this reason, it is available only to partners who publish under ESG. Otherwise, partners should implement their receipt validation system.

Unity Manual Receipt Validation

Restoring Purchases

If a player deletes the game from their device, they might need to restore their subscription or non-consumable purchases. IdleKit does not currently provide support for restoring purchases. If a player wants to restore purchases, they should contact the community. Community will manually add previously purchased items to the game.

Subscription renewals are handled directly by the platform stores, and IdleKit initiates purchase the next time player opens the game.