コード例 #1
0
        private void ObtainOwnedPurchases(OwnedPurchasesReq ownedPurchasesReq)
        {
            ITask <OwnedPurchasesResult> task = iapClient.ObtainOwnedPurchases(ownedPurchasesReq);

            task.AddOnSuccessListener((result) =>
            {
                Debug.Log("[HMSIAPManager] ObtainOwnedPurchases");
                foreach (var item in result.InAppPurchaseDataList)
                {
                    Debug.Log("[HMSIAPManager] ProductId: " + item.ProductId + ", ProductName: " + item.ProductName + ", Price: " + item.Price);
                }
                OnObtainOwnedPurchasesSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                Debug.LogError("[HMSIAPManager]: ObtainOwnedPurchases failed. CauseMessage: " + exception.WrappedCauseMessage + ", ExceptionMessage: " + exception.WrappedExceptionMessage);
                OnObtainOwnedPurchasesFailure?.Invoke(exception);
            });
        }
コード例 #2
0
        public void ObtainOwnedPurchases()
        {
            if (iapAvailable != true)
            {
                OnObtainOwnedPurchasesFailure?.Invoke(IAP_NOT_AVAILABLE);
                return;
            }


            Debug.Log("[HMSIAPManager] ObtainOwnedPurchaseRequest");
            ObtainOwnedPurchases(new OwnedPurchasesReq()
            {
                PriceType = PriceType.IN_APP_CONSUMABLE
            });
            ObtainOwnedPurchases(new OwnedPurchasesReq()
            {
                PriceType = PriceType.IN_APP_NONCONSUMABLE
            });
            ObtainOwnedPurchases(new OwnedPurchasesReq()
            {
                PriceType = PriceType.IN_APP_SUBSCRIPTION
            });
        }