Google Play 課金拡張機能の使用
google play固有の拡張機能をUnity Iapと統合して、購入処理とサブスクリプション管理を強化する方法を説明します。
読み終わるまでの所要時間 1 分最終更新 10日前
Unity Iap 用の google play 固有の拡張にアクセスします。難読化されたアカウント ID とプロファイル ID を詐欺防止とアカウントリンクに使用し、ユーザーがサブスクリプション契約条件を変更したときに、ディファードサブスクリプションの支払いの変更をリッスンします。
拡張機能
Unity Iapでgoogle play固有の機能を使用する方法を説明します。難読化された ID の設定と読み取り
ユーザー プライバシーを保護しながら、難読化されたアカウントIDとプロファイルIDを使用して購入をユーザー アカウントに関連付けます。これらの識別子は不正の検出にヘルプし、購入をバックエンド ユーザー システムにリンクできます。using UnityEngine.Purchasing;class GooglePlayObfuscatedIdsSample{ 静的 void SetObfuscatedIds(StoreController storeController, 文字列 profileId, 文字列 accountId) { var googlePlayStoreService = storeController.GooglePlayStoreExtendedService; if (googlePlayStoreService != null) { googlePlayStoreService.SetObfuscatedProfileId(profileId); googlePlayStoreService.SetObfuscatedAccountId(accountId); } } static void ReadObfuscatedIdsUsingConvenienceFunction(StoreController storeController, Order order) { var googlePlayPurchasingService = storeController.GooglePlayStoreExtendedPurchaseService; if (googlePlayPurchasingService != null) { var obfuscatedProfileId = googlePlayPurchasingService.GetObfuscatedProfileId(order); var obfuscatedAccountId = googlePlayPurchasingService.GetObfuscatedAccountId(order); //... } } static void ReadObfuscatedIdsFromOrder(Order order) { var profileId = order.Info.Google?.ObfuscatedProfileId; var accountId = order.Info.Google?.ObfuscatedAccountId; }}
ディファード サブスクリプション変更のリッスン
ユーザーがディファードでサブスクリプションのティアを変更 (アップグレードまたはダウングレード) すると、変更は次の更新日に効果になります。このリスナーを使用して、このような変更が発生したときに通知され、UI を更新したり、保留中のサブスクリプション変更をユーザーに通知したりできます。using UnityEngine.Purchasing;class AddGoogleEventListenersSample{ void AddGoogleEventListeners(StoreController storeController) { var googlePlayPurchasingService = storeController.GooglePlayStoreExtendedPurchaseService; if (googlePlayPurchasingService != null) { googlePlayPurchasingService.OnDeferredPaymentUntilRenewalDate += OnDeferredPaymentUntilRenewalDate; } } void OnDeferredPaymentUntilRenewalDate(DeferredPaymentUntilRenewalDateOrder deferredPaymentOrder) { var currentOrder = deferredPaymentOrder.CurrentOrder; var nextSubscriptionProduct = deferredPaymentOrder.SubscriptionOrdered; //... }}