Define your products
Create and configure Unity IAP products using the IAP Catalog or programmatically in your code.
Read time 1 minuteLast updated 10 hours ago
To support in-app purchases in your application, first define the products you want to sell in the following ways:
Prerequisites
Before you begin, complete the steps in the Get started guide.Define products in the IAP Catalog
The IAP Catalog provides a graphical interface in the Unity Editor for configuring in-app purchase products. This is the recommended approach for most developers, as it requires minimal scripting. To add in-app products to your application, use the IAP Catalog:- In the Unity Editor, select Services > In-App Purchasing > IAP Catalog.
- Select Add Product to create a new product entry.
- Enter a unique Product ID, select the appropriate product type (Consumable, Non-Consumable, or Subscription), and provide a display name.
- Set attributes such as price, payout, and store-specific IDs. For information on each setting, refer to the IAP Catalog window reference.
Define products programmatically
You can also declare your product list in a script. This method provides greater flexibility and is suitable for more complex scenarios. To define products programmatically:- During the initialization stage, create an instance of the class.
CatalogProvider - Use the method to add each product, or
AddProduct()to add multiple products at once.AddProducts() - For each product, specify a unique cross-store and
Product ID.Product Type
100_gold_coinsCatalogProviderFetchProducts()using UnityEngine;using UnityEngine.Purchasing;public class MyIAPManager { public MyIAPManager () { var catalog = new CatalogProvider(); catalog.AddProduct("100_gold_coins", ProductType.Consumable); // Connect to the store catalog.FetchProducts(UnityIAPServices.DefaultProduct().FetchProductsWithNoRetries); }}