Skip to content

In-App Purchases Overview

The in-app purchase service sells your products for real money through the platform’s own store: Google Play on Android and the App Store on iOS. The SDK starts the store, keeps the list of products on sale up to date, reports every purchase to analytics, and keeps track of every purchase the player paid for until your game delivers it.

How it works

  1. You list your products in the Live Ops Dashboard under the IAPConfig module of the Configuration section of your game.
  2. When configurations are initialized, the SDK reads that list and starts the store with it. If the list is empty, the store is not started.
  3. Every time a newer configuration is applied, the SDK compares the products in it with the ones on sale and updates the store when they differ.
  4. Your game reads the products with their store prices and calls Purchase() when the player buys one.
  5. You deliver what the player bought and call FinishTransaction(). Until you do, the purchase stays owed to the player, across app restarts.

You never hand the SDK a product list yourself. The products on sale are always the ones in the configuration.

Accessing the service

using PlayOps.InAppPurchases;
using TactileModules.InAppPurchase;
PlayOpsInAppPurchases inAppPurchases = playOpsSDK.InAppPurchases();

The product, transaction and result types live in the TactileModules.InAppPurchase namespace.

Configuration has to be initialized

The store starts when configurations are initialized, not when the SDK is. Make sure your game calls Initialize() on the configuration service at startup:

var configurations = playOpsSDK.Configurations();
configurations.Initialize();

Until then the store has nothing to sell, and every purchase answers StoreUnavailable.

Which products are sold

Only consumable products are sold. A product in IAPConfig with any other product type, or without an identifier, is skipped and a warning is logged.

Configuring products on the dashboard

  1. Go to the Live Ops Dashboard under your game.
  2. Open the Configurations service.
  3. Search for the IAPConfig module.
  4. Configure the products. Each entry in InAppProducts is one product.
  5. Publish the configuration. The SDK only receives published configuration, on the game’s next sync. Until you publish, players keep the products they had.
The IAPConfig module on the Live Ops Dashboard, with the product tier1 open in InAppProducts

The product identifier

Identifier is only the last part of the product’s store identifier. The SDK builds the rest from your app’s bundle identifier.

Fields

FieldWhat the SDK does with it
IdentifierThe last part of the store identifier. See The product identifier.
TitleShown as the product’s Title until the store sends its own.
DescriptionOnly used by the development store, which the SDK uses in the editor and in development builds.
PriceReported in the purchase analytics events, in cents: 0.99 is reported as 99. The development store also reports it as the store price.
CurrencyCodeOnly used by the development store.
FormattedPriceShown as the product’s FormattedPrice until the store sends its own price.
AmountNot read by the SDK.
ProductTypeMust be Consumable. Products of any other type are skipped.
OnSaleNot read by the SDK.

What’s next