Documentation

In-App Purchasing

Client API

SDK API

In-App Purchasing

Fetch your Remote Catalog

Fetch your Remote Catalog for a payment provider store.
Read time 2 minutesLast updated 11 hours ago

You need to create a script that connects to the
StoreController
to explicitly fetch the Remote Catalog you deployed. Attach this script to the same GameObject as the initialization script.
To fetch the Remote Catalog for a payment provider store, you need to instantiate the
RemoteCatalogProvider
and then make a call to
FetchRemoteCatalog
with the
PaymentProvider.Name
to retrieve the products from the Unity IAP backend.
You can then either use the
RemoteCatalogProvider
directly to call
FetchProducts
or you can pass the product list to the
FetchProducts
from the
IProductService
or
StoreController
.

Reference information

The following elements are relevant when you fetch the Remote Catalog for payment providers:

Parameter

Description

RemoteCatalogProvider
This is the class used to obtain the Remote Catalog to use along with IAP. The Remote Catalog is obtained from the IAP backend.
UnityIAPServices
This is the starting point to communicate with IAP. You need to get the following services:
  • StoreService
  • ProductService
  • PurchaseService
StoreController
This is a wrapper over
UnityIAPServices
. If you prefer to interact with a single class, pass the
storeName
to the constructor.
PaymentProvider.Name
This is an identifier used to register a Direct to Consumer (D2C) payment provider with
UnityIAPServices
and the
StoreController
. Note that this field is used for configuration purposes and does not return the display name of the provider.
Important
When you make calls to the
RemoteCatalogProvider
, make sure to specify the correct store name, which for a D2C payment provider is
PaymentProvider.Name
.

Fetch Remote Catalog example script

Refer to the following example script:
using System.Collections.Generic;using System.Threading.Tasks;using UnityEngine;using UnityEngine.Purchasing;public class PurchaseManager : MonoBehaviour{ StoreController m_StoreController; // Called by the ServiceOrchestrator after Auth is complete public async Task InitializeIAP() { m_StoreController = UnityIAPServices.StoreController(PaymentProvider.Name); m_StoreController.OnPurchasePending += OnPurchasePending; await m_StoreController.Connect(); m_StoreController.OnProductsFetched += OnProductsFetched; // 1. Initialize the RemoteCatalogProvider RemoteCatalogProvider catalogProvider = new RemoteCatalogProvider(); // 2. Fetch the catalog explicitly for the Payment Provider var fetchRemoteCatalogResult = await catalogProvider.FetchRemoteCatalog(new List<string> { PaymentProvider.Name }); if (!fetchRemoteCatalogResult.Success) throw fetchRemoteCatalogResult.Exception!; // 3. Pass the remote definitions to the StoreController var productDefinitions = catalogProvider.GetProducts(); m_StoreController.FetchProducts(productDefinitions); } private void OnPurchasePending(PendingOrder order) { // Handle purchase validation and rewarding before confirming the order Debug.Log($"Order pending: {order.Info}"); } void OnProductsFetched(List<Product> products) { // Handle fetched products (e.g., populate UI) Debug.Log("Fetched products:"); foreach (var product in products) { foreach (var catalogListing in product.catalogListings.Values) { Debug.Log($"ID: {catalogListing.definition.id} - Price: {catalogListing.metadata.localizedPriceString}"); } } }}

Next steps

This page is part of a workflow to set up D2C payment providers with IAP. To continue this workflow, choose one of the following options: