リモートカタログの取得
支払いプロバイダーストアのリモートカタログを取得します。
読み終わるまでの所要時間 1 分最終更新 8日前
リモートカタログを明示的にフェッチするために、
StoreControllerRemoteCatalogProviderFetchRemoteCatalogRemoteCatalogProviderFetchProductsIProductServiceStoreControllerFetchProductsリファレンス情報
以下の要素は、支払いプロバイダーのリモートカタログを取得するときに関連します。パラメーター | 説明 |
|---|---|
| IAP とともに使用するリモートカタログを取得するために使用するクラスです。リモートカタログは IAP バックエンドから取得されます。 |
| これは IAP との通信の出発点です。以下のサービスを受ける必要があります。
|
| これは |
| これは、D2C(ダイレクト ツー コンシューマー)支払いプロバイダーを |
リモートカタログの取得スクリプト例
以下のスクリプト例を参照してください。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.RemoteCatalogProvider の初期化 RemoteCatalogProvider catalogProvider = new RemoteCatalogProvider(); // 2.支払いプロバイダーのカタログを明示的に取得します var fetchRemoteCatalogResult = await catalogProvider.FetchRemoteCatalog(); if (!fetchRemoteCatalogResult.Success) throw fetchRemoteCatalogResult.例外!; // 3.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) { Foreach (product.catalogListings.Values の var catalogListing) { Debug.Log($"ID: {catalogListing.definition.id} - Price: {catalogListing.metadata.localizedPriceString}"); } } }}