How to Add In-App Purchases in Unity Games

- May 21, 2025
Monetization is a crucial aspect of modern game development, especially in mobile and free-to-play models. Among the most effective monetization strategies is in-app purchasing, which allows players to buy digital items, upgrades, and virtual currency within the game. If you’re a developer working with Unity, learning how to integrate Unity IAP (In-App Purchasing) is essential to generating revenue and enhancing user experience.
This guide walks you through every aspect of adding in-app purchases to Unity games—from setup to best practices—along with real-world examples, code snippets, and actionable insights. Whether you're building for iOS, Android, or multiple platforms, this article will equip you with everything needed to implement monetization effectively using Unity.
As mobile gaming continues to dominate app stores, monetization models are evolving. In-app purchases have emerged as one of the most profitable methods, especially for free-to-play titles. In 2025, over 75% of mobile game revenue comes from IAPs, surpassing ads and subscriptions in many cases.
If you’re working with a Unity game development company or building independently, knowing how to work with Unity IAP is a key skill in today’s mobile gaming ecosystem.
Unity IAP is a service provided by Unity Gaming Services (UGS) that allows developers to easily implement in-app purchases across platforms using a unified API. It simplifies the complex process of managing multiple app store integrations.
Unity Gaming Services (UGS) also provides tools for analytics, remote configuration, and player engagement, making it easier to manage and scale monetization strategies.
Before diving into implementation, it's important to understand the different types of IAPs:
Items that are purchased, used, and can be purchased again (e.g., in-game currency, health potions)
One-time purchases that unlock permanent content or features (e.g., premium skins, extra levels)
Recurring payments that unlock ongoing benefits or content (e.g., battle passes, VIP access)
Ensure your Unity version is up to date (preferably Unity 2021 or later). Start by creating a new project or opening your existing game
Unity Gaming Services must be set up and linked with your Unity project ID.
Define your IAP items on the Google Play Console or Apple App Store Connect. For each item, configure:
Example:
In your Unity project, create a script to initialize Unity IAP and define available products.
csharp
CopyEdit
using UnityEngine.Purchasing;
public class IAPManager : MonoBehaviour, IStoreListener
{
private static IStoreController storeController;
private static IExtensionProvider extensionProvider;
public static string COIN_PACK = "com.yourgame.coinpack1";
void Start()
{
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct(COIN_PACK, ProductType.Consumable);
UnityPurchasing.Initialize(this, builder);
}
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
storeController = controller;
extensionProvider = extensions;
}
public void BuyCoinPack()
{
storeController.InitiatePurchase(COIN_PACK);
}
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
{
if (args.purchasedProduct.definition.id == COIN_PACK)
{
Debug.Log("Coin pack purchased!");
// Add coins to player's wallet
}
return PurchaseProcessingResult.Complete;
}
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
{
Debug.LogError("Purchase failed: " + failureReason);
}
}
Use the Google Play testing tracks (internal, alpha, or beta) or TestFlight for iOS. Ensure testers are registered, and your build is uploaded properly. Testing must use real accounts and sandbox environments provided by Apple and Google.
Make sure players understand what they are purchasing. Use visual cues like icons, tooltips, and popups.
Ensure items are valuable but not pay-to-win. Maintain a balance to avoid alienating non-paying users.
Use Unity Gaming Services’ Remote Config to dynamically create discounts, bundles, or time-sensitive offers.
Store receipts and verify purchases server-side when possible to prevent spoofing or refund exploits.
Use localized pricing, descriptions, and currencies to increase conversion in international markets.
Imagine a mobile puzzle game with 10 million downloads. The developer implements Unity IAP with:
By analyzing player behavior using Unity Analytics and A/B testing different pricing models, the developer increases ARPU (average revenue per user) by 18% in 6 months, all while keeping the core gameplay free.
Use Unity’s Remote Config to control which products are visible at what times. This allows you to test which in-app offers perform best in different regions or user groups.
Pair IAP with Unity Analytics to track:
Send in-game events (e.g., iap_purchase_success) to analyze user journeys and refine your monetization funnel.
As mobile and cross-platform gaming grow, Unity continues to enhance its Unity IAP service. Expect new features like:
Whether you’re a solo dev or a Unity game development company, the opportunity to create profitable games with well-designed in-app purchases has never been better.
Adding in-app purchases to your Unity game is not just about revenue—it's about creating a more engaging and rewarding experience for players. With Unity IAP and Unity Gaming Services, you can seamlessly implement consumables, non-consumables, and subscriptions across platforms. By following best practices and testing strategies, you ensure that monetization enhances gameplay rather than disrupts it.
At Vasundhara Infotech, we help developers and studios build, scale, and monetize games using cutting-edge tools and practices. Whether you need help integrating Unity IAP or building a complete game, our experts are ready to assist.
Contact us today to turn your Unity game into a successful business.
Copyright © 2025 Vasundhara Infotech. All Rights Reserved.