Documentation

​
​

Development

User Acquisition

Monetization

Industry

  1. Unity In-App Purchasing

Create your catalog programmatically

Use the CatalogProvider class to define your catalog in code for flexible or runtime-driven configurations.
Read time 1 minute
Last updated 2 months ago

You can define your catalog directly in code using the
CatalogProvider
class. This approach gives you full programmatic control over your catalog configuration and is useful in complex scenarios, such as if you have a game with a very large catalog that constantly adds new items in large quantities.
If your catalog is static and you prefer a visual setup, you can configure listings using the IAP Catalog window in the Unity Editor instead. Refer to Create a catalog in the Editor for more information. You can still access a catalog created this way from your scripts. Refer to Fetch products from a catalog created in the Editor for more information.
Note
For a Direct-to-Consumer (D2C) payment provider, you need to create a remote catalog.
To define catalog listings programmatically:
  1. During the initialization stage, create an instance of the
    CatalogProvider
    class.
  2. Use the
    AddProduct()
    method to add each listing, or
    AddProducts()
    to add multiple listings at once.
  3. For each listing, specify a unique cross-store
    Product ID
    and
    Product Type
    .
The following example shows how to add a consumable listing with the ID
100_gold_coins
to a
CatalogProvider
, and later call
FetchProducts()
to retrieve the defined listing.
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); }}
Note
Use the
CatalogProvider
class to configure store-specific IDs and other advanced configurations directly in code.

Additional resources

  • Manage your catalog in the Dashboard

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Additional resources


Report a problem with this page