Exemple #1
0
        private void QueryPurchases(String continuationToken)
        {
            Log.Info(TAG, "QueryPurchase");

            OwnedPurchasesReq req = new OwnedPurchasesReq();

            req.PriceType         = IapClientPriceType.InAppNonconsumable;
            req.ContinuationToken = continuationToken;

            Task task = mClient.ObtainOwnedPurchases(req).AddOnSuccessListener(new OwnedListenerImp(this)).AddOnFailureListener(new OwnedListenerImp(this));
        }
        private void QuerySubscriptions(System.String continuationToken)
        {
            Log.Info(TAG, "QuerySubscriptions");

            OwnedPurchasesReq req = new OwnedPurchasesReq();

            req.PriceType         = IapClientPriceType.InAppSubscription;
            req.ContinuationToken = continuationToken;

            Task task = mClient.ObtainOwnedPurchases(req).AddOnSuccessListener(new OwnedListenerImp(this.view)).AddOnFailureListener(new OwnedListenerImp(this.view));
        }
        private void ObtainOwnedPurchaseRecord(OwnedPurchasesReq req)
        {
            ITask <OwnedPurchasesResult> task = iapClient.ObtainOwnedPurchaseRecord(req);

            task.AddOnSuccessListener((result) =>
            {
                Debug.Log("HMSP: ObtainOwnedPurchaseRecord");
                foreach (var item in result.InAppPurchaseDataList)
                {
                    Debug.Log("[HMSPlugin]: ProductId: " + item.ProductId + ", ProductName: " + item.ProductName + ", Price: " + item.Price);
                }
                OnObtainOwnedPurchaseRecordSuccess?.Invoke(result);
            }).AddOnFailureListener((exception) =>
            {
                Debug.Log("HMSP: Error on ObtainOwnedPurchaseRecord");
                OnObtainOwnedPurchaseRecordFailure?.Invoke(exception);
            });
        }
        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);
            });
        }
Exemple #5
0
    private void recoverPurchases()
    {
        OwnedPurchasesReq ownedPurchasesReq = new OwnedPurchasesReq();

        ITask <OwnedPurchasesResult> task = iapClient.ObtainOwnedPurchases(ownedPurchasesReq);

        task.AddOnSuccessListener((result) =>
        {
            Debug.Log("HMSP: recoverPurchases");
            foreach (string inAppPurchaseData in result.InAppPurchaseDataList)
            {
                InAppPurchaseData inAppPurchaseDataBean = new InAppPurchaseData(inAppPurchaseData);
                string purchaseToken = inAppPurchaseDataBean.PurchaseToken;

                ConsumePurchase(purchaseToken);

                Debug.Log("HMSP: recoverPurchases result> " + result.ReturnCode);
            }
        }).AddOnFailureListener((exception) =>
        {
            Debug.Log("HMSP: Error on recoverPurchases" + exception.StackTrace);
        });
    }