In-app purchases (IAP) let players buy coins, remove ads, unlock levels or get premium features inside your game. Combined with ads, they are the main revenue source for free-to-play mobile games. This guide explains how to plan and set up in-app purchases in a Unity game using Unity's In-App Purchasing package.
Types of In-App Products
- Consumable: can be bought repeatedly and is used up, such as coins, gems or extra lives.
- Non-consumable: bought once and owned forever, such as "Remove Ads" or a level pack. Must be restorable.
- Subscription: recurring access, such as a VIP pass with daily rewards.
Step 1: Plan Your Store
Decide what players will buy and why. Good IAP offers solve a real need: saving time, removing interruptions or expressing style. Start with a small catalog, for example three coin packs, a "Remove Ads" option and a starter bundle. Give each product a clear ID such as com.yourstudio.game.coins_small.
Step 2: Install Unity In-App Purchasing
Open Window > Package Manager, find In-App Purchasing in the Unity Registry and install it. Depending on your Unity version, you may be asked to link the project to Unity Gaming Services in the Services window. The package supports Google Play and the Apple App Store from the same code.
Step 3: Create Products in the Stores
In Google Play Console, open your app, go to Monetize > Products and create in-app products or subscriptions with exactly the same IDs you use in Unity. Your app must already have a build uploaded to a testing track before you can create products. In App Store Connect, add products under the app's In-App Purchases section, complete the metadata and include a review screenshot.
Step 4: Define Products in Unity
You can define products with the IAP Catalog window, or in code by adding each product ID and type to a configuration builder. Initialize Unity Purchasing when the game starts so prices are fetched from the stores and can be displayed in the player's local currency.
Step 5: Handle Purchases
When a player taps a buy button, call the purchase method with the product ID. In the purchase callback, check which product was bought and grant the reward: add coins, set a "remove ads" flag or unlock content. Save the result immediately so it survives app restarts. Always grant items in the callback after the store confirms the purchase, never when the button is pressed.
Step 6: Restore Purchases
Non-consumable products and subscriptions must be restorable when a player reinstalls the game or switches devices. Apple requires a visible Restore Purchases button on iOS. On Google Play, purchases are typically restored automatically during initialization.
Step 7: Validate Receipts
To reduce fraud, validate receipts. Unity IAP includes local receipt validation tools, and for higher-value games you can validate on your own server. At minimum, do not trust a purchase that the store has not confirmed.
Step 8: Test Thoroughly
- Google Play: add license testers in Play Console and test with a build from a testing track. Test purchases are not charged.
- iOS: use Sandbox tester accounts or StoreKit testing in Xcode.
- Test successful purchases, cancelled purchases, network errors, restores and what happens when the app closes mid-purchase.
Design Tips for Better IAP Revenue
- Show the value clearly: "1,000 coins + 20% bonus" is more persuasive than a plain number.
- Offer a low-price starter pack to convert first-time buyers.
- Combine "Remove Ads" with a small bonus to make it feel generous.
- Place the store where players naturally need resources, such as after running out of lives.
- Never make the game impossible without paying; fair games get better reviews and more long-term revenue.
Policy Reminders
Digital goods in mobile games must use the official store billing systems. Clearly disclose that the game contains in-app purchases, and do not design offers that target children inappropriately. Mention purchases in your privacy policy; our Privacy Policy Generator can add the section automatically.
Several projects in our Store already include IAP integration, so you only need to create your products and replace the IDs.
Frequently Asked Questions
Why are my products not loading?
Check that product IDs match exactly, that products are active in the store console, and that you are testing with a build installed from a testing track (Google Play) or with a sandbox account (iOS).
How much do app stores charge?
Both stores take a commission on digital sales, with reduced rates available for many small developers through their programs. Check the current terms in each console.
Should I sell coins or direct unlocks?
Coins give flexibility and work well in games with many items, while direct unlocks are simpler and more transparent. Many games use both.
Comments (0)