docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Defining Products in scripts

    You can declare your Product list programmatically using the Purchasing Configuration Builder. You must provide a unique cross-store Product ID and Product Type for each Product:

    using UnityEngine;
    using UnityEngine.Purchasing;
    
    public class MyIAPManager {
        public MyIAPManager () {
            var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
            builder.AddProduct("100_gold_coins", ProductType.Consumable);
            // Initialize Unity IAP...
        }
    }
    
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)