/// <summary>
    /// This will be called when a purchase completes.
    /// </summary>
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
		Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
		Debug.Log("Receipt: " + e.purchasedProduct.receipt);

        m_PurchaseInProgress = false;

        // Now that my purchase history has changed, update its UI
        UpdateHistoryUI();

        // Indicate we have handled this purchase, we will not be informed of it again.x
        return PurchaseProcessingResult.Complete;
    }
Example #2
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // Unity IAP's validation logic is only included on these platforms.
        #if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_TVOS
        // Prepare the validator with the secrets we prepared in the Editor
        // obfuscation window.
        var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
            AppleTangle.Data(), Application.bundleIdentifier);

        try
        {
            // On Google Play, result will have a single product Id.
            // On Apple stores receipts contain multiple products.
            var result = validator.Validate(args.purchasedProduct.receipt);
            Debug.Log("Receipt is valid. Contents:");
            foreach (IPurchaseReceipt productReceipt in result)
            {
                if (String.Equals(productReceipt.productID, firstCurrencyId, StringComparison.Ordinal))
                {
                    Bank.PlusMoney(MoneyPrice.firstPurchase);
                    PreferencesSaver.SetPurchaseComplete();
                    Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                }
                else
                {
                    libraryMenu.windowWarning.Show("Произошла ошибка покупки. Ваши деньги не списаны");

                    Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
                }

            }
            // Unlock the appropriate content here.
        }
        catch (IAPSecurityException)
        {
            libraryMenu.windowWarning.Show("Произошла ошибка покупки. Ваши деньги не списаны");
        }
        #endif

        return PurchaseProcessingResult.Complete;
    }
Example #3
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, FIRST_PRODUCT, StringComparison.Ordinal))
        {
            // The consumable item has been successfully purchased
            Coins(150);
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, SECOND_PRODUCT, StringComparison.Ordinal))
        {
            Coins(950);
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, THIRD_PRODUCT, StringComparison.Ordinal))
        {
            Coins(1800);
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, FOURTH_PRODUCT, StringComparison.Ordinal))
        {
            Coins(3800);
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, FIFTH_PRODUCT, StringComparison.Ordinal))
        {
            Coins(10000);
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #4
0
    /// <summary>
    /// Called when a purchase completes.
    ///
    /// May be called at any time after OnInitialized().
    /// </summary>
    public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)
    {
        Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
        Debug.Log("Receipt: " + e.purchasedProduct.receipt);

        m_PurchaseInProgress = false;

        int winGem = 0;
        config_wealth_item config = GameMgr.resourceMgr.config_wealth.GetItemByType((int)WealthTypeEnum.Money);

        string[] prices = config.price.Split(new char[] { ',' });

        for (int i = 0; i < prices.Length; i++)
        {
            string price = prices[i];

            string[] price2s = price.Split(new char[] { '|' });

            if (price2s[0] == e.purchasedProduct.definition.id)
            {
                winGem = int.Parse(price2s[2]);
                break;
            }
        }

        WealthInfo gemInfo = PlayerModel.Instance.GetWealth((int)WealthTypeEnum.Gem);
        PromptModel.Instance.Pop("+" + winGem, true, gemInfo.type);

        gemInfo.count += winGem;

        PlayerModel.Instance.SaveWealths(gemInfo.type);

		config_sort_item diamond_item = GameMgr.resourceMgr.config_sort.GetItemByTypeAndSpecial(1, "11101");
		SocialModel.Instance.ReportScore(diamond_item.gid, gemInfo.count);

        string prefsKey = PlayerPrefsUtil.DIAMOND_BUY + e.purchasedProduct.definition.id;
        PlayerPrefsUtil.SetInt(prefsKey, PlayerPrefsUtil.GetInt(prefsKey) + 1);
        
        return PurchaseProcessingResult.Complete;
    }
Example #5
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, product_1, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
            //ScoreManager.score += 100;
            Constants.totalScore += 500;
            PlayerPrefs.SetInt("totalScore", Constants.totalScore);
            PlayerPrefs.Save();
        }
        // Or ... a non-consumable product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, product_2, StringComparison.Ordinal))
        {
            //Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{1}'", args.purchasedProduct.definition.id));
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            Constants.totalScore += 1000;
            PlayerPrefs.SetInt("totalScore", Constants.totalScore);
            PlayerPrefs.Save();
        }
        // Or ... a subscription product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, product_3, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            Constants.totalScore += 2000;
            PlayerPrefs.SetInt("totalScore", Constants.totalScore);
            PlayerPrefs.Save();
        }
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #6
0
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
 {
     // A consumable product has been purchased by this user.
     if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_100_BISCUITS, StringComparison.Ordinal))
     {
         Debug.Log("You have just bought 100 Biscuits!");
         PlayerPrefs.SetInt("currency", PlayerPrefs.GetInt("currency") + 100);
         // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
     }
     // Or ... a non-consumable product has been purchased by this user.
     else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_250_BISCUITS, StringComparison.Ordinal))
     {
         Debug.Log("You have just bought 250 Biscuits!");
         PlayerPrefs.SetInt("currency", PlayerPrefs.GetInt("currency") + 250);
         // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
     }
     // Or ... a subscription product has been purchased by this user.
     else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_400_BISCUITS, StringComparison.Ordinal))
     {
         Debug.Log("You have just bought 400 Biscuits!");
         PlayerPrefs.SetInt("currency", PlayerPrefs.GetInt("currency") + 400);
         // TODO: The subscription item has been successfully purchased, grant this to the player.
     }
     // Or ... a non-consumable product has been purchased by this user.
     else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_STARTER_PACK, StringComparison.Ordinal))
     {
         Debug.Log("You have just bought Starter Pack!");
         PlayerPrefs.SetInt("noAds", 1);
         PlayerPrefs.SetInt("currency", PlayerPrefs.GetInt("currency") + 100);
         // TODO: The subscription item has been successfully purchased, grant this to the player.
     }
     // Or ... an unknown product has been purchased by this user. Fill in additional products here....
     else
     {
         Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
     }
     PlayerPrefs.Save();
     FirstLaunchScript.ins.SaveToCloud();
     return(PurchaseProcessingResult.Complete);
 }
Example #7
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
        Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
        Debug.Log("Receipt: " + e.purchasedProduct.receipt);
        payAtion(1);
        GameMgr.inst().purchaserEvent(curId);
        // try {
        //  var result = validator.Validate (e.purchasedProduct.receipt);
        //  Debug.Log ("Receipt is valid. Contents:");
        //  foreach (IPurchaseReceipt productReceipt in result) {
        //      Debug.Log(productReceipt.productID);
        //      Debug.Log(productReceipt.purchaseDate);
        //      Debug.Log(productReceipt.transactionID);

        //      AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
        //      if (null != apple) {
        //          Debug.Log(apple.originalTransactionIdentifier);
        //          Debug.Log(apple.subscriptionExpirationDate);
        //          Debug.Log(apple.cancellationDate);
        //          Debug.Log(apple.quantity);


        //          //如果有服务器,服务器用这个receipt去苹果验证。
        //          var receiptJson = JSONObject.Parse(e.purchasedProduct.receipt);
        //          var receipt = receiptJson.GetString("Payload");
        //      }

        //      GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
        //      if (null != google) {
        //          Debug.Log(google.purchaseState);
        //          Debug.Log(google.purchaseToken);
        //      }
        //  }
        //  return PurchaseProcessingResult.Complete;
        // } catch (IAPSecurityException) {
        //  Debug.Log("Invalid receipt, not unlocking content");
        //  return PurchaseProcessingResult.Complete;
        // }
        return(PurchaseProcessingResult.Complete);
    }
Example #8
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, "words500", StringComparison.Ordinal))
        {
            //Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.

            //MANAGE SUCCESFUL PURCHASE
            StartCoroutine(activate("words500"));
        }

        else if (String.Equals(args.purchasedProduct.definition.id, "words2500", StringComparison.Ordinal))
        {
            //Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.

            //MANAGE SUCCESFUL PURCHASE
            StartCoroutine(activate("words2500"));
        }

        else if (String.Equals(args.purchasedProduct.definition.id, "words5000", StringComparison.Ordinal))
        {
            //Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.

            //MANAGE SUCCESFUL PURCHASE
            StartCoroutine(activate("words5000"));
        }

        else
        {
            //Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #9
0
    //결제 성공
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        //Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.defnition.id));
        //Debug.Log(string.Format("결제 완료 , 구매 영수증 : '{0}'", args.purchasedProduct.defnition.id));

        switch (args.purchasedProduct.definition.id)
        {
        case productId1:
            //ex) coin 1000개 지급
            DataManager.Instance.AddCoins(1000);
            break;

        case productId2:
            //5000개 지급
            DataManager.Instance.AddCoins(5000);
            break;

        case productId3:
            //10000개 지급
            DataManager.Instance.AddCoins(10000);
            break;

        case productId4:
            //30000개 지급
            DataManager.Instance.AddCoins(30000);
            break;

        case productId5:
            //50000개 지급
            DataManager.Instance.AddCoins(50000);
            break;

        case productId6:
            //광고제거 적용
            DataManager.Instance.freepassAdView = true;
            break;
        }
        return(PurchaseProcessingResult.Complete);
    }
Example #10
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        processPurchaseCalled = true;

        //Debug.Log("processPurchaseCalled " + processPurchaseCalled);

        // a non-consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_NO_ADS, StringComparison.Ordinal))
        {
            //Debug.Log("You have just removed the ads");

            // TODO: The non-consumable item has been successfully purchased, grant this item to the player. NBNBNBNB Victor
            // Remove the purchase button that says "remove ads" here
            //if (!buttonRemoved){
            if(removeAdsButton != null)
                removeAdsButton.gameObject.SetActive(false);
            //    buttonRemoved = true;
            //}

            // Remove the ads here
            GameControl.control.adsDisabled = true;
            GameControl.control.levelReached = 21;
            GameControl.control.Save();

            // Then if the result is successful, we need to go back to the start menu
            levelManager.LoadLevel("01b Level_Select");

        }
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            //Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs 
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still 
        // saving purchased products to the cloud, and when that save is delayed. 
        return PurchaseProcessingResult.Complete;
    }
Example #11
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }


        return(PurchaseProcessingResult.Complete);
    }
    /// <summary>
    /// Called when a purchase completes.
    ///
    /// May be called at any time after OnInitialized().
    /// </summary>
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        var skuDetails = extensions.GetExtension <IGooglePlayStoreExtensions>().GetProductJSONDictionary();
        Debug.Log($"IAPReceipt: {e.purchasedProduct.receipt}");
        Debug.Log($"SkuDetails: {string.Join(";", skuDetails.Select(x => x.Key + "=" + x.Value).ToArray())}");

        Debug.Log($"e.purchasedProduct.definition.storeSpecificId: {e.purchasedProduct.definition.storeSpecificId}");
        var skuDetailsForProduct = skuDetails[e.purchasedProduct.definition.storeSpecificId];

        var payload = JSON.Parse(e.purchasedProduct.receipt)["Payload"];
        var parsedReceiptPayload = JSON.Parse(payload);
        Debug.Log($"Payload: {payload}");
        var jsonPurchaseInfo = parsedReceiptPayload["json"];
        var signature        = parsedReceiptPayload["signature"];

        _qonversionPurchases.TrackPurchase(skuDetailsForProduct, jsonPurchaseInfo, signature);
#endif


        return(PurchaseProcessingResult.Complete);
    }
Example #13
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_10_COINS, StringComparison.Ordinal))
        {
            VariablesToSave.coins += 10;
            PlayerPrefs.SetInt("Coins", VariablesToSave.coins);
        }

        else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_50_COINS, StringComparison.Ordinal))
        {
            VariablesToSave.coins += 50;
            PlayerPrefs.SetInt("Coins", VariablesToSave.coins);
        }

        else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_200_COINS, StringComparison.Ordinal))
        {
            VariablesToSave.coins += 200;
            PlayerPrefs.SetInt("Coins", VariablesToSave.coins);
        }

        else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_1000_COINS, StringComparison.Ordinal))
        {
            VariablesToSave.coins += 1000;
            PlayerPrefs.SetInt("Coins", VariablesToSave.coins);
        }

        else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_REMOVE_ADS, StringComparison.Ordinal))
        {
            Destroy(ads);
        }

        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        return(PurchaseProcessingResult.Complete);
    }
    public static bool OnPurchase(PurchaseEventArgs args)
    {
        string         id              = args.purchasedProduct.definition.id;
        IAPProductData productData     = GetProductData(id);
        bool           isValidPurchase = true;

        if (productData == null)
        {
            //invalid product
            isValidPurchase = false;
        }
        else
        {
            foreach (var payout in productData.payouts)
            {
                switch (payout.type)
                {
                case PayoutType.Diamond:
                    //User.AddGems(payout.quantity);
                    break;

                case PayoutType.Hint:
                    User.AddHint(payout.quantity);
                    break;

                case PayoutType.Other:
                    if (InAppPurchaseHelper.CompareProductId(remove_ads, args))
                    {
                        PlayerPrefs.SetInt(Const.PREF_NO_ADS, 1);
                        PlayerPrefs.Save();
                        SetupNoAds();
                    }
                    break;
                }
            }
        }
        return(isValidPurchase);
        //SS.View.Manager.Add(PopupController.POPUP_SCENE_NAME, new PopupData(PopupType.OK, msg));
    }
Example #15
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
    {
        Debug.Log("IAP支付成功:" + e.purchasedProduct.metadata.localizedTitle);
        Debug.Log(string.Format("交易id:{0} | 收据:{1}", e.purchasedProduct.transactionID, e.purchasedProduct.receipt));
#if UNITY_EDITOR
        string appStore = "AppleAppStore";
        string payload  = "MIIT0AYJKoZIhvcNAQcCoIITwTCCE70CAQExCzAJBgUrDgMCGgUAMIIDcQYJKoZIhvcNAQcBoIIDYgSCA14xggNaMAoCAQgCAQEEAhY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jEWnXItiX1YjKkUkAumSO2nmQJX00Od44gXfQ9Gstaf3dF3Njd2SO9my17t5eG/hglhWcXSWsPpNBC3dDZoJjacoIjXr7gzfGQwt3XxDQ5LHU3n2qLUXM5+LdN6JWuTfvNV/znVUYcBgo8BBhJ+Md0qiJBt7Kub0V4AhkrNMjEI69PK73vMWPiCTiXK+ILYQ9dOXMkadgW6UNMvzSt1dyhSRu3Q1f+SqScTyFOHA56qLjqs0dMQkofXigRuj+LLmj";
#else
        JsonData jd       = JsonMapper.ToObject(e.purchasedProduct.receipt);
        string   appStore = jd["Store"].ToString();
        string   payload  = jd["Payload"].ToString();
#endif
        string goodsID = GoodsData.GetGoodsID(e.purchasedProduct.definition.id);
        Debug.Log("goodsID:" + goodsID);
        string transactionID = e.purchasedProduct.transactionID;

        GameMainManager.instance.netManager.GetOrder(goodsID, 1, (ret, res) =>
        {
            string orderID = res.request_id;
            GameMainManager.instance.netManager.Purchase(appStore, transactionID, payload, orderID, (r, data) => {
                if (data.isOK)
                {
                    Debug.Log("IAP发放物品成功");
                    controller.ConfirmPendingPurchase(e.purchasedProduct);

                    //Alert.Show(string.Format("成功购买【{0}】", e.purchasedProduct.metadata.localizedTitle));
                }
                else
                {
                    Alert.Show("发放物品失败:" + data.errmsg);
                }
                Waiting.Disable();
            });
        });



        return(PurchaseProcessingResult.Pending);
    }
Example #16
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, RemoveAds, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));

            //actually remove ads
            AdMobRequest.DestroyBannerView();

            //save purchase in local data
            GameDataLoaderAndSaver.dataControl.SetShowAdsAndSave(false);
        }
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #17
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        m_isPurchasing = false;

        if (args == null || args.purchasedProduct == null || args.purchasedProduct.definition == null)
        {
            return(PurchaseProcessingResult.Complete);
        }

        Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));

        SendAnalyticsEvent(args.purchasedProduct);

        Backend.GetInstance().ReportPurchase(args.purchasedProduct.definition.id, args.purchasedProduct.metadata.localizedPriceString);

        if (PurchaseFinished != null)
        {
            PurchaseFinished(true, args.purchasedProduct.definition.id);
        }

        return(PurchaseProcessingResult.Complete);
    }
Example #18
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        Debug.Log("IAP " + args);
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
            //ScoreManager.score += 100;
        }
        // Or ... a non-consumable product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // TODO: The non-consumable item has been successfully purchased, grant this item to the player.

            PlayerPrefs.SetInt("HasPurchasedIAP", 1);
            savedToGalleryTitle.text = "Saved!!";
            savedToGalleryBody.SetActive(true);
            failedSavedToGalleryBody.SetActive(false);
            savedToGallery.SetActive(true);
        }
        // Or ... a subscription product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // TODO: The subscription item has been successfully purchased, grant this to the player.
        }
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #19
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, GOLD_50, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, GOLD_100, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            GameManager.Instance.Coins += 100;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, GOLD_300, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            GameManager.Instance.Coins += 300;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, GOLD_600, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            GameManager.Instance.Coins += 600;
        }
        else if (String.Equals(args.purchasedProduct.definition.id, NO_ADS, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            GameManager.Instance.NoAds = 1;
        }
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        GameManager.Instance.SaveData();

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #20
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductRemoveAdID, StringComparison.Ordinal))
        {
            buyBonusForIndex(0);
            _analiticsController.userBuyBlockAd();
        }
        else if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductScoreCount1ID, StringComparison.Ordinal))
        {
            buyBonusForIndex(0);
            _analiticsController.userBuyScoresCount1();
        }
        else if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductScoreCount2ID, StringComparison.Ordinal))
        {
            buyBonusForIndex(1);
            _analiticsController.userBuyScoresCount2();
        }
        else if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductScoreCount3ID, StringComparison.Ordinal))
        {
            buyBonusForIndex(2);
            _analiticsController.userBuyScoresCount3();
        }
        else if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductScoreCount4ID, StringComparison.Ordinal))
        {
            buyBonusForIndex(3);
            _analiticsController.userBuyScoresCount4();
        }
        else if (String.Equals(args.purchasedProduct.definition.id, gameSettings.inAppProductScoreCount5ID, StringComparison.Ordinal))
        {
            buyBonusForIndex(4);
            _analiticsController.userBuyScoresCount5();
        }
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        return(PurchaseProcessingResult.Complete);
    }
        private bool Validate(PurchaseEventArgs e)
        {
            Log(string.Format("Validate:\n definitionId={0}\n receipt={1}", e.purchasedProduct.definition.id, e.purchasedProduct.receipt));
            try
            {
                CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(), AppleTangle.Data(), Application.identifier);
                IPurchaseReceipt[]     result    = validator.Validate(e.purchasedProduct.receipt);
                foreach (IPurchaseReceipt productReceipt in result)
                {
                    Log(string.Format("Validate Result:\n productId={0}\n purchaseDate={1}\n transactionId={2}", productReceipt.productID, productReceipt.purchaseDate, productReceipt.transactionID));
                }
                return(true);
            }
            catch (IAPSecurityException)
            {
#if UNITY_EDITOR
                return(positiveEvent);
#else
                return(false);
#endif
            }
        }
Example #22
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (String.Equals(args.purchasedProduct.definition.id, productAbone1, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("abone 1 satın alındı"));
        }
        // Or ... a non-consumable product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, productAbone2, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("abone 2 satın alındı"));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, productAbone3, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("abone 3 satın alındı"));
        }
        else if (String.Equals(args.purchasedProduct.definition.id, productAbone4, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("abone 4 satın alındı"));
        }

        return(PurchaseProcessingResult.Complete);
    }
Example #23
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_NO_ADS, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
            PlayerPrefs.SetInt("NoAds", 1);
            Appodeal.hide(Appodeal.BANNER_BOTTOM);
        }

        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #24
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
        {
            if (string.Equals(e.purchasedProduct.definition.id, productIdFullAccess, StringComparison.Ordinal))
            {
                var userData = SceneData.GetUserData();

                userData.isAccessEasyLevel = true;
                userData.isAccessHardLevel = true;

                Debug.Log($"Purchase: {e.purchasedProduct.definition.id}");
            }
            else if (string.Equals(e.purchasedProduct.definition.id, productIdLevel1Access, StringComparison.Ordinal))
            {
                var userData = SceneData.GetUserData();

                userData.isAccessEasyLevel = true;

                Debug.Log($"Purchase: {e.purchasedProduct.definition.id}");
            }

            return(PurchaseProcessingResult.Complete);
        }
Example #25
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        Debug.Log(args.purchasedProduct.hasReceipt);
        string receipt = args.purchasedProduct.receipt;

        Debug.Log("receipt " + receipt);

        //validate receipt
        GooglePurchaseData data = new GooglePurchaseData(receipt);

        //send to gs
        new LogEventRequest()
        .SetEventKey("buyIAP")
        .SetEventAttribute("result", receipt)
        .SetEventAttribute("data1", data.inAppDataSignature)
        .SetEventAttribute("data2", data.inAppPurchaseData)
        .Send((response) => {
            GSData scriptData = response.ScriptData;
        });

        /*new GooglePlayBuyGoodsRequest()
         *      .SetSignature(data.inAppDataSignature)
         *      .SetSignedData(data.inAppPurchaseData)
         *      .Send((response) => {
         *              if (!response.HasErrors)
         *              {
         *                      Debug.Log("Successful purchase");
         *              }
         *              else
         *              {
         *                      Debug.Log("Purchase error: " + response.Errors.JSON);
         *              }
         *      });*/
        return(PurchaseProcessingResult.Complete);
    }
Example #26
0
    // ====================================================================================================
    #region 영수증 검증

    /*
     *
     */
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // 뒤끝 영수증 검증 처리
        BackendReturnObject validation = Backend.Receipt.IsValidateGooglePurchase(args.purchasedProduct.receipt, "receiptDescription");

        string msg = "";

        // 영수증 검증에 성공한 경우
        if (validation.IsSuccess())
        {
            // 구매 성공한 제품에 대한 id 체크하여 그에맞는 보상
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, removeAds, StringComparison.Ordinal))
            {
                msg = string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id);
                MessagePopManager.instance.ShowPop(msg);
                Debug.Log(msg);

                AdsManager.instance.SetRemoveAds();
                BackEndServerManager.instance.BuyRemoveAdsSuccess();
            }
        }
        // 영수증 검증에 실패한 경우
        else
        {
            // Or ... an unknown product has been purchased by this user. Fill in additional products here....
            msg = string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id);
            MessagePopManager.instance.ShowPop(msg);
            Debug.Log(msg);

            BackEndServerManager.instance.BuyRemoveAdsFailed();
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #27
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, coins100, StringComparison.Ordinal))
            {
                int coins = PlayerPrefs.GetInt("coins");
                PlayerPrefs.SetInt("coins", coins + 100);
            }
            else if (String.Equals(args.purchasedProduct.definition.id, coins200, StringComparison.Ordinal))
            {
                int coins = PlayerPrefs.GetInt("coins");
                PlayerPrefs.SetInt("coins", coins + 200);
            }
            else if (String.Equals(args.purchasedProduct.definition.id, coins1000, StringComparison.Ordinal))
            {
                int coins = PlayerPrefs.GetInt("coins");
                PlayerPrefs.SetInt("coins", coins + 1000);
            }
            else if (String.Equals(args.purchasedProduct.definition.id, coins10000, StringComparison.Ordinal))
            {
                int coins = PlayerPrefs.GetInt("coins");
                PlayerPrefs.SetInt("coins", coins + 10000);
            }
            else if (String.Equals(args.purchasedProduct.definition.id, noads, StringComparison.Ordinal))
            {
                PlayerPrefs.SetInt("BlockAds", 1);
            }
            // Or ... an unknown product has been purchased by this user. Fill in additional products here....
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return(PurchaseProcessingResult.Complete);
        }
Example #28
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        if (args.purchasedProduct.definition.id == beerKey)
        {
            PlayerPrefs.SetInt(beerKey, 1);
            DebugMsg(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }

        // A consumable product has been purchased by this user.

        /*else if (string.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
         * {
         *  Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         *  //TODO:  The consumable item has been successfully purchased, add 100 coins to the player's in-game score.
         * }
         * // Or ... a non-consumable product has been purchased by this user.
         * else if (string.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
         * {
         *  Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         *  // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
         * }
         * // Or ... a subscription product has been purchased by this user.
         * else if (string.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
         * {
         *  Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         *  // TODO: The subscription item has been successfully purchased, grant this to the player.
         * }*/
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            DebugMsg(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #29
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // A consumable product has been purchased by this user.
            //if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
            //{
            //    Debug.Log(string.Format("ProcessPurchase: Consumable PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            //    // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.

            //}
            // Or ... a non-consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: Non-Consumable PASS. Product: '{0}'", args.purchasedProduct.definition.id));

                //Remove ads for the player here!
                GlobalStats.disabledAds = true;
                GlobalStats.Save();
                SoundManager.PlaySound(SoundManager.Sounds.COIN);
                options.ShowResult(3);
            }
            // Or ... a subscription product has been purchased by this user.
            //else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
            //{
            //    Debug.Log(string.Format("ProcessPurchase: Subscription PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            //    // TODO: The subscription item has been successfully purchased, grant this to the player.
            //}
            //// Or ... an unknown product has been purchased by this user. Fill in additional products here....
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
                options.ShowResult(4, "ProcessPurchase: FAIL. Unrecognized product: '{0}'" + args.purchasedProduct.definition.id);
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return(PurchaseProcessingResult.Complete);
        }
Example #30
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_50_ZAPS, StringComparison.Ordinal))
            {
                Debug.Log("You've just bought 50 zaps! good times!");
                AddZaps(50);
                AudioManager.Instance.Spawn2DAudio(successfulPurchaseClip, true);
                GameMaster.Instance.m_UIManager.m_ShopCanvas.m_WarpStorePanel.m_SuccessfulPurchaseAnimation.Play();
            }
            else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_100_ZAPS, StringComparison.Ordinal))
            {
                Debug.Log("You've just bought 100 zaps! good times!");
                AddZaps(100);
                AudioManager.Instance.Spawn2DAudio(successfulPurchaseClip, true);
                GameMaster.Instance.m_UIManager.m_ShopCanvas.m_WarpStorePanel.m_SuccessfulPurchaseAnimation.Play();
            }
            else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_250_ZAPS, StringComparison.Ordinal))
            {
                Debug.Log("You've just bought 250 zaps! good times!");
                AddZaps(250);
                AudioManager.Instance.Spawn2DAudio(successfulPurchaseClip, true);
                GameMaster.Instance.m_UIManager.m_ShopCanvas.m_WarpStorePanel.m_SuccessfulPurchaseAnimation.Play();
            }
            else if (String.Equals(args.purchasedProduct.definition.id, PRODUCT_1000_ZAPS, StringComparison.Ordinal))
            {
                Debug.Log("You've just bought 1000 zaps! good times!");
                AddZaps(1000);
                AudioManager.Instance.Spawn2DAudio(successfulPurchaseClip, true);
                GameMaster.Instance.m_UIManager.m_ShopCanvas.m_WarpStorePanel.m_SuccessfulPurchaseAnimation.Play();
            }
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }

            return(PurchaseProcessingResult.Complete);
        }
Example #31
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        if (String.Equals(args.purchasedProduct.definition.id, Buy100, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            PlayerPrefs.SetInt("Star", PlayerPrefs.GetInt("Star") + 100);
        }

        if (String.Equals(args.purchasedProduct.definition.id, Buy500, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            PlayerPrefs.SetInt("Star", PlayerPrefs.GetInt("Star") + 500);
        }

        if (String.Equals(args.purchasedProduct.definition.id, Buy1000, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            PlayerPrefs.SetInt("Star", PlayerPrefs.GetInt("Star") + 1000);
        }
        // Or ... a non-consumable product has been purchased by this user.
        else if (String.Equals(args.purchasedProduct.definition.id, NoAds, StringComparison.Ordinal))
        {
            Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
            IAPManager.RemoveAds();
        }
        // Or ... a subscription product has been purchased by this user.
        // Or ... an unknown product has been purchased by this user. Fill in additional products here....
        else
        {
            Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }

        // Return a flag indicating whether this product has completely been received, or if the application needs
        // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
        // saving purchased products to the cloud, and when that save is delayed.
        return(PurchaseProcessingResult.Complete);
    }
Example #32
0
    // Automatically Called by Unity IAP when
    // 1. NORMAL PURCHASE (Charging is done, waiting for transaction)
    // 2. PURCHASE RESTORATION (Restoring Purchase on Init)
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // Client Side Receipt Validation
        bool validPurchase = CheckReceipt(args.purchasedProduct);

        if (validPurchase)
        {
            Debug.Log(string.Format("[In-App Purchase Manager] >>>>>> ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
        }
        else
        {
            Debug.LogError(string.Format("[In-App Purchase Manager] >>>>>> ProcessPurchase: Fail (receipt Valid Error)  Product: '{0}'", args.purchasedProduct.definition.id));
        }

        isBuyingInClient = false;

        // NORMAL PURCHASE
        if (isPurchaseUnderProcess)
        {
            Debug.LogWarning("[In-App Purchase Manager] <<<<<< Pending sku start!");
            return(PurchaseProcessingResult.Pending);

            // ########################################################################
            // ## YOUR SERVER LOGIC GOES HERE : VALIDATE THE RECEIPT AND GIVE THE ITEMS
            // ########################################################################
            // YourServerLogic(args.purchaseProduct.definition.id, args.purchaseProduct, ReleaseAllUnfinishedUnityIAPTransactions)
        }
        // PURCHASE RESTORATION
        else
        {
            Debug.LogWarning("[In-App Purchase Manager] <<<<<< Restoring Unfinished Transactions!");
            Product product   = args.purchasedProduct;
            string  productId = product.definition.id;
            StartCoroutine(PurchaseRestoreEnumerator(productId, product));

            return(PurchaseProcessingResult.Complete);
        }
    }
Example #33
0
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) 
 {
     // A consumable product has been purchased by this user.
    
     if (String.Equals(args.purchasedProduct.definition.id, kProductID1000won, StringComparison.Ordinal))
     {
         //NGUIDebug.Log (string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         
         // 1000won In App Purchase 구매 보상 ( 보석 50개 지급 )
         GameData.coin_struct.gemstone = GameData.coin_struct.gemstone + 50;
         GameData.gemstone_total_label.GetComponent<UILabel>().text = GameData.int_to_label_format_ea((ulong)GameData.coin_struct.gemstone);
         
         // 보석 저장.
         PlayerPrefs.SetInt("gemstone", GameData.coin_struct.gemstone);   
         PlayerPrefs.Save();
         
         // 스킬 활성화 버튼 체크
         GM.check_skills_enable_or_not();
         
     }  // Or ... a subscription product has been purchased by this user.    
     else if (String.Equals(args.purchasedProduct.definition.id, kProductID2000won, StringComparison.Ordinal))
     {
         //NGUIDebug.Log (string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         
         // 2000won In App Purchase 구매 보상 ( 보석 150개 지급 )
         GameData.coin_struct.gemstone = GameData.coin_struct.gemstone + 150;
         GameData.gemstone_total_label.GetComponent<UILabel>().text = GameData.int_to_label_format_ea((ulong)GameData.coin_struct.gemstone);
         
         // 보석 저장.
         PlayerPrefs.SetInt("gemstone", GameData.coin_struct.gemstone);   
         PlayerPrefs.Save();
         
         // 스킬 활성화 버튼 체크
         GM.check_skills_enable_or_not();
         
     }  // Or ... a subscription product has been purchased by this user.      
     else if (String.Equals(args.purchasedProduct.definition.id, kProductID10000won, StringComparison.Ordinal))
     {
         //NGUIDebug.Log (string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         
         // 1000won In App Purchase 구매 보상 ( 보석 500개 지급 )
         GameData.coin_struct.gemstone = GameData.coin_struct.gemstone + 500;
         GameData.gemstone_total_label.GetComponent<UILabel>().text = GameData.int_to_label_format_ea((ulong)GameData.coin_struct.gemstone);
         
         // 보석 저장.
         PlayerPrefs.SetInt("gemstone", GameData.coin_struct.gemstone);   
         PlayerPrefs.Save();
         
         // 스킬 활성화 버튼 체크
         GM.check_skills_enable_or_not();
         
     }  // Or ... a subscription product has been purchased by this user.    
     else if (String.Equals(args.purchasedProduct.definition.id, kProductID20000won, StringComparison.Ordinal))
     {
         //NGUIDebug.Log (string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
         
         // 1000won In App Purchase 구매 보상 ( 보석 2000개 지급 )
         GameData.coin_struct.gemstone = GameData.coin_struct.gemstone + 2000;
         GameData.gemstone_total_label.GetComponent<UILabel>().text = GameData.int_to_label_format_ea((ulong)GameData.coin_struct.gemstone);
         
         // 보석 저장.
         PlayerPrefs.SetInt("gemstone", GameData.coin_struct.gemstone);   
         PlayerPrefs.Save();
         
         // 스킬 활성화 버튼 체크
         GM.check_skills_enable_or_not();
         
     }  // Or ... a subscription product has been purchased by this user.            
     else
     {
         //NGUIDebug.Log (string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
     }// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
     return PurchaseProcessingResult.Complete;
 }
Example #34
0
		public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) 
		{
			// A consumable product has been purchased by this user.
			if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
			{
				Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));//If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
//				ScoreManager.score += 100;


				//書き換える場所============================================================================================
				// アイテム1をあげる処理(マシン02のフラグを開放する処理)
				variableManage.openMachine02 = true;
				//============================================================================================


			}

			// Or ... a non-consumable product has been purchased by this user.
			else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
			{
				Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));}// Or ... a subscription product has been purchased by this user.
			else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
			{
				Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));}// Or ... an unknown product has been purchased by this user. Fill in additional products here.
			else 
			{
				Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));}// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
			return PurchaseProcessingResult.Complete;
		}
Example #35
0
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
 {
     eventService.Dispatch<IAPPurchasedEvent>(new IAPPurchasedEvent(e.purchasedProduct.definition.id));
     return PurchaseProcessingResult.Complete;
 }
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
 {
     this.m_Analytics.OnPurchaseSucceeded(e.purchasedProduct);
     return this.m_ForwardTo.ProcessPurchase(e);
 }
Example #37
0
	/// <summary>
	/// This will be called when a purchase completes.
	/// </summary>
	public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
	{
		Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
		Debug.Log("Receipt: " + e.purchasedProduct.receipt);

		m_PurchaseInProgress = false;

		// Now that my purchase history has changed, update its UI
		UpdateHistoryUI();

		#if RECEIPT_VALIDATION
		if (Application.platform == RuntimePlatform.Android ||
			Application.platform == RuntimePlatform.IPhonePlayer ||
			Application.platform == RuntimePlatform.OSXPlayer) {
			try {
				var result = validator.Validate(e.purchasedProduct.receipt);
				Debug.Log("Receipt is valid. Contents:");
				foreach (IPurchaseReceipt productReceipt in result) {
					Debug.Log(productReceipt.productID);
					Debug.Log(productReceipt.purchaseDate);
					Debug.Log(productReceipt.transactionID);

					GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
					if (null != google) {
						Debug.Log(google.purchaseState);
						Debug.Log(google.purchaseToken);
					}

					AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
					if (null != apple) {
						Debug.Log(apple.originalTransactionIdentifier);
						Debug.Log(apple.cancellationDate);
						Debug.Log(apple.quantity);
					}
				}
			} catch (IAPSecurityException) {
				Debug.Log("Invalid receipt, not unlocking content");
				return PurchaseProcessingResult.Complete;
			}
		}
		#endif

		// You should unlock the content here.

		// Indicate we have handled this purchase, we will not be informed of it again.x
		return PurchaseProcessingResult.Complete;
	}
Example #38
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, kProductIDConsumable, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                // The consumable item has been successfully purchased, add 100 coins to the player's in-game score.

                PlayerPrefs.SetInt("ChannelPoints", PlayerPrefs.GetInt("ChannelPoints") + 100);
                //ScoreManager.score += 100;
            }
            // Or ... a non-consumable product has been purchased by this user.
            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
            }
            // Or ... a subscription product has been purchased by this user.
            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                // TODO: The subscription item has been successfully purchased, grant this to the player.
            }
            // Or ... an unknown product has been purchased by this user. Fill in additional products here....
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return PurchaseProcessingResult.Complete;
    }
Example #39
0
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        // A consumable product has been purchased by this user.
        int coins = Coins[args.purchasedProduct.definition.id];

        PlayerData pd = ScoreModule.GetPlayerData();
        pd.PlayerMoney += coins;
        ScoreModule.SavePlayerData(pd);

        BuyButton.HidePanel(GameObject.Find("Buy"));
        BuyButton.HidePanel(GameObject.Find("Fade"));


        
        return PurchaseProcessingResult.Complete;
    }
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
 {
     if (String.Equals(args.purchasedProduct.definition.id, Coins50_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 50;
         Bank.SaveBankValue();
         Debug.Log("50 Coins Added");
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins115_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 115;
         Bank.SaveBankValue();
         Debug.Log("115 Coins Added");
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins195_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 195;
         Bank.SaveBankValue();
         Debug.Log("195 Coins Added");
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins290_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 290;
         Bank.SaveBankValue();
         Debug.Log("290 Coins Added");
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins400_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 400;
         Bank.SaveBankValue();
         Debug.Log("400 Coins Added");
     }
     else if (String.Equals(args.purchasedProduct.definition.id, Coins1000_ID, StringComparison.Ordinal))
     {
         Debug.Log(string.Format("ProcessPurchase:  PASS. Product '{0}'", args.purchasedProduct.definition.id));
         Bank.money += 1000;
         Bank.SaveBankValue();
         Debug.Log("1000 Coins Added");
     }
     else
     {
         Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
     }
     return PurchaseProcessingResult.Complete;
 }
Example #41
0
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            if (_gameManager == null) return PurchaseProcessingResult.Complete;
            // A consumable product has been purchased by this user.
            if (String.Equals(args.purchasedProduct.definition.id, kProductIDGold099, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));//If the consumable item has been successfully purchased, add 1000 coins to the player's coin count.
                foreach (UpgradeStruct us in _gameManager._allUpgrades)
                {
                    if (us.MoneyCost == 99)
                    {
                        _gameManager.AddCoins(us.CoinCost);
                        break;
                    }
                }
            }

            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDGold199, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                foreach (UpgradeStruct us in _gameManager._allUpgrades)
                {
                    if (us.MoneyCost == 199)
                    {
                        _gameManager.AddCoins(us.CoinCost);
                        break;
                    }
                }
            }
            else if (String.Equals(args.purchasedProduct.definition.id, kProductIDGold499, StringComparison.Ordinal))
            {
                Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                foreach (UpgradeStruct us in _gameManager._allUpgrades)
                {
                    if (us.MoneyCost == 499)
                    {
                        _gameManager.AddCoins(us.CoinCost);
                        break;
                    }
                }
            }// Or ... an unknown product has been purchased by this user. Fill in additional products here.
            else
            {
                Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
            }// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
            return PurchaseProcessingResult.Complete;
        }
Example #42
0
	/// <summary>
	/// This will be called when a purchase completes.
	/// </summary>
	public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
	{
		Debug.Log("Purchase OK: " + e.purchasedProduct.definition.id);
		Debug.Log("Receipt: " + e.purchasedProduct.receipt);

		m_LastTransationID = e.purchasedProduct.transactionID;
		m_LastReceipt = e.purchasedProduct.receipt;
		m_PurchaseInProgress = false;

		// Now that my purchase history has changed, update its UI
		UpdateHistoryUI();

		#if RECEIPT_VALIDATION
		// Local validation is available for GooglePlay and Apple stores
		if (m_IsGooglePlayStoreSelected ||
			Application.platform == RuntimePlatform.IPhonePlayer ||
			Application.platform == RuntimePlatform.OSXPlayer) {
			try {
				var result = validator.Validate(e.purchasedProduct.receipt);
				Debug.Log("Receipt is valid. Contents:");
				foreach (IPurchaseReceipt productReceipt in result) {
					Debug.Log(productReceipt.productID);
					Debug.Log(productReceipt.purchaseDate);
					Debug.Log(productReceipt.transactionID);

					GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
					if (null != google) {
						Debug.Log(google.purchaseState);
						Debug.Log(google.purchaseToken);
					}

					AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
					if (null != apple) {
						Debug.Log(apple.originalTransactionIdentifier);
						Debug.Log(apple.subscriptionExpirationDate);
						Debug.Log(apple.cancellationDate);
						Debug.Log(apple.quantity);
					}
				}
			} catch (IAPSecurityException) {
				Debug.Log("Invalid receipt, not unlocking content");
				return PurchaseProcessingResult.Complete;
			}
		}
		#endif

		// CloudMoolah purchase completion / finishing currently requires using the API 
		// extension IMoolahExtension.RequestPayout to finish a transaction.
		if (m_IsCloudMoolahStoreSelected)
		{
			// Finish transaction with CloudMoolah server
			m_MoolahExtensions.RequestPayOut(e.purchasedProduct.transactionID, 
				(string transactionID, RequestPayOutState state, string message) => {
					if (state == RequestPayOutState.RequestPayOutSucceed) {
						// Finally, finish transaction with Unity IAP's local
						// transaction log, recording the transaction id there
						m_Controller.ConfirmPendingPurchase(e.purchasedProduct);

						// Unlock content here.
					} else {
						Debug.Log("RequestPayOut: failed. transactionID: " + transactionID + 
							", state: " + state + ", message: " + message);
						// Finishing failed. Retry later.
					}
			});
		}

		// You should unlock the content here.

		// Indicate if we have handled this purchase. 
		//   PurchaseProcessingResult.Complete: ProcessPurchase will not be called
		//     with this product again, until next purchase.
		//   PurchaseProcessingResult.Pending: ProcessPurchase will be called 
		//     again with this product at next app launch. Later, call 
		//     m_Controller.ConfirmPendingPurchase(Product) to complete handling
		//     this purchase. Use to transactionally save purchases to a cloud
		//     game service. 
		return PurchaseProcessingResult.Complete;
	}
 /// <summary>Records an in-app purchase in the Fuse system made using the Unity IAP plugin.</summary>
 /// <remarks>
 /// This function is meant to be called from Unity's IStoreListener.ProcessPurchase function passing in the PurchaseEventArgs parameter.
 /// </remarks>
 /// <param name="args">The parameter of Unity's IStoreListener.ProcessPurchase that contains information about the purchase.</param>
 public static void RegisterUnityInAppPurchase(PurchaseEventArgs args)
 {
     if(args != null)
         RegisterUnityInAppPurchase(args.purchasedProduct);
 }
Example #44
0
		/// <summary>
		/// This will be called when a purchase completes.
		/// Optional: verify new product receipt.
		/// </summary>
		public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
		{
            string id = e.purchasedProduct.definition.id;

            if (validator && validator.shouldValidate(VerificationType.onPurchase))
            {
                validator.Validate(id, e.purchasedProduct.receipt);
                if (!(validator is ReceiptValidatorClient))
                    return PurchaseProcessingResult.Pending;
            }
            else
            {
                PurchaseVerified(id);
            }
                
            // Indicate we have handled this purchase, we will not be informed of it again
            return PurchaseProcessingResult.Complete;
		}
        public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
        {
            //Debug.Log("IAPMgr ProcessPurchase: Product: "+ args.purchasedProduct.definition.id);
            GooglePlayManager.OnPurchaseSuccess(args.purchasedProduct.definition.id);

            if (mCurrentOnSuccessCallback != null)
            {
                mCurrentOnSuccessCallback();
                mCurrentOnSuccessCallback = null;
            }

            // Return a flag indicating whether this product has completely been received, or if the application needs
            // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
            // saving purchased products to the cloud, and when that save is delayed.
            return PurchaseProcessingResult.Complete;
        }
Example #46
0
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) {
   //Debug.Log("ProcessPurchase: " + "transactionID(" + args.purchasedProduct.transactionID + "), productId(" + args.purchasedProduct.definition.id + ")");
   try {
     if (charactersMenu.buyComplete(args.purchasedProduct.transactionID, args.purchasedProduct.definition.id, isOnPurchasing)) {
       Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));//If the consumable item has been successfully purchased, add 100 coins to the player's in-game score.
     } else {
       Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
     }// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
   } catch (NullReferenceException e) {
     // This usually happens when the user turned charater select menu while buying character.
     UICharacters uiCharacters = transform.Find("Characters/" + args.purchasedProduct.definition.id).GetComponent<UICharacters>();
     uiCharacters.buyComplete(args.purchasedProduct.definition.id, isOnPurchasing);
   }
   if (isOnPurchasing) isOnPurchasing = false;
   return PurchaseProcessingResult.Complete;
 }
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));

        switch (args.purchasedProduct.definition.id)
        {
            case productId1:

                // ex) gem 10개 지급

                UserManager.Instance().myGold = UserManager.Instance().myGold + 10000;
                UserManager.Instance().DateLabelUpdate();

                break;

                //        case productId2:
                //
                //            // ex) gem 50개 지급
                //
                //            break;
                //
                //        case productId3:
                //
                //            // ex) gem 100개 지급
                //
                //            break;
                //
                //        case productId4:
                //
                //            // ex) gem 300개 지급
                //
                //            break;
                //
                //        case productId5:
                //
                //            // ex) gem 500개 지급
                //
                //            break;
        }

        return PurchaseProcessingResult.Complete;
    }
Example #48
0
	public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs args)
	{
		if (String.Equals (args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal)) {
			Debug.Log (string.Format ("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));

			BuyComplete (kProductNameAppleNonConsumable);


		}
		// Or ... an unknown product has been purchased by this user. Fill in additional products here.
		else {
			Debug.Log (string.Format ("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));

			BuyFail.Show ();
		}// Return a flag indicating wither this product has completely been received, or if the application needs to be reminded of this purchase at next app launch. Is useful when saving purchased products to the cloud, and when that save is delayed.
		return PurchaseProcessingResult.Complete;
	}