예제 #1
0
        public static void RestorePurchases()
        {
            CheckIfInitialised();

            if (registeredProducts == null)
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Restore purchases can be done only after getting products information from store.");
                return;
            }

            List <BillingTransaction> _restoredTransactions = new List <BillingTransaction>();

            foreach (BillingProduct _curProduct in registeredProducts)
            {
                if (IsProductPurchased(_curProduct.ProductIdentifier))
                {
                    BillingTransaction _transaction = CreateTransactionObject(_curProduct.ProductIdentifier, eBillingTransactionState.RESTORED, null);

                    // Add it to list of restored transactions
                    _restoredTransactions.Add(_transaction);
                }
            }

            PostTransactionEvent(kRestoreFinishedEventName, _restoredTransactions.ToArray());
        }
예제 #2
0
        public static void RestoreCompletedTransactions()
        {
            CheckIfInitialised();

            if (registeredProducts == null)
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Restore purchases can be done only after getting products information from store.");
                return;
            }

            List <BillingTransaction> _restoredTransactions = new List <BillingTransaction>();

            foreach (BillingProduct _curProduct in registeredProducts)
            {
                if (IsProductPurchased(_curProduct.ProductIdentifier))
                {
                    BillingTransaction _transaction = GetTransactionDetails(_curProduct.ProductIdentifier, eBillingTransactionState.RESTORED, null);

                    // Add it to list of restored transactions
                    _restoredTransactions.Add(_transaction);
                }
            }

            // Send callback
            SendFinishedTransactionCallback(_restoredTransactions.ToArray());
        }
예제 #3
0
        private static void CheckIfInitialised()
        {
#if UNITY_ANDROID
            if (string.IsNullOrEmpty(NPSettings.Billing.Android.PublicKey))
            {
                Console.LogError(Constants.kDebugTag, "[EditorStore] Please add public key in NPSettings for Billing to work on Android.");
            }
#endif
        }
예제 #4
0
 public static void CustomVerificationFinished(BillingTransaction _transaction)
 {
     Console.LogError(Constants.kDebugTag, Constants.kFeatureNotSupported);
 }