public void Btn_Fun_Cash390() { Productid = "com.appsgraphy.kvsskakao.cash0330"; dicMenuList ["popup_buycash"].SetActive(true); GetTranjectionkey(); mProductCode = "1000007360"; mPaymentPrice = 30000; #if UNITY_ANDROID GoogleIAB.consumeProduct(Productid); #endif SetPopupPriceLabel("330", "29.99", "30,000"); Ag.LogString(" MenuManager_Shop :: Btn_Fun_Cash390 >>> ProductID " + Productid); }
// Use this for initialization void Start() { canRestored = false; // array of product ID's from iTunesConnect. MUST match exactly what you have there! #if UNITY_IOS StoreKitManager.autoConfirmTransactions = true; var productIdentifiers = new string[] { Constants.PRODUCT_ID }; StoreKitBinding.requestProductData(productIdentifiers); #elif UNITY_ANDROID var skus = new string[] { Constants.PRODUCT_ID }; // var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" }; GoogleIAB.queryInventory(skus); #endif HZIncentivizedAd.SetDisplayListener(videoAdListener); GameInit(); }
// void RetryIAP(){ // orderNo = RequestIAP.Response.data.orderNo; // purchaseSucceededEvent(mPurchase); // } void mRequestIAP() { #if (UNITY_ANDROID) UtilMgr.ShowLoading(); //if (RequestIAP.Response.data != null) { //if(RequestIAP.Response.data.productId==itemid&&RequestIAP.Response.data.productCode==itemcode){ // orderNo = RequestIAP.Response.data.orderNo; //RequestIAP.Response.data. // GoogleIAB.init(Constants.GOOGLE_PUBLIC_KEY); GoogleIAB.purchaseProduct(itemcode); //, RequestIAP.Response.data.purchaseKey ); //} //} #else // orderNo = RequestIAP.Response.data.orderNo; IOSMgr.BuyItem(itemcode); #endif }
void SetupPurchases() { Debug.Log("KongStoreKitDemo: Setting up purchases..."); #if UNITY_IPHONE Debug.Log("KongStoreKitDemo: requesting products"); StoreKitBinding.requestProductData(new string[] { "com.kongregate.mobile.games.angryBots.t05_coins" }); #elif UNITY_ANDROID GoogleIABManager.billingSupportedEvent += () => { Debug.Log("KongStoreKitDemo: billing is supported query inventory"); mPurchaseReady = true; var skus = new string[] { "com.kongregate.android.games.angrybots.t03_hard" }; GoogleIAB.queryInventory(skus); }; GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => { Debug.Log("KongStoreKitDemo: queryInventory succeeded"); foreach (GooglePurchase purchase in purchases) { Debug.Log("KongStoreKitDemo: queryInventory succeeded: " + purchase.productId); verifyGoogleReceipt(purchase); } }; GoogleIABManager.queryInventoryFailedEvent += (sku) => { Debug.Log("KongStoreKitDemo: queryInventoryFailedEvent: " + sku); }; GoogleIABManager.purchaseSucceededEvent += purchase => { Debug.Log("Google IAB callback - purchased product: " + purchase); verifyGoogleReceipt(purchase); }; GoogleIABManager.purchaseFailedEvent += message => { Debug.Log("Google IAB callback - purchase failed: " + message); KongregateAPI.GetAPI().Analytics.FinishPurchase(KongregateAPI.PURCHASE_FAIL, message, getPurchaseFields()); mPurchaseReady = true; }; GoogleIABManager.consumePurchaseSucceededEvent += purchase => { Debug.Log("KongStoreKitDemo: Google IAB callback - consume succeeded: " + purchase); }; GoogleIABManager.consumePurchaseFailedEvent += message => { Debug.Log("Google IAB callback - consume failed: " + message); }; GoogleIAB.init(_GooglePublicKey); #elif UNITY_WEBPLAYER || UNITY_WEBGL mPurchaseReady = true; #endif }
public void NoAds() { Main.Instance.PlayButtonSound(); #if UNITY_IOS if (_products != null && _products.Count > 0) { int productIndex = 0; //We have only one product // Random.Range( 0, _products.Count ); var product = _products[productIndex]; Debug.Log("preparing to purchase product: " + product.productIdentifier); StoreKitBinding.purchaseProduct(product.productIdentifier, 1); } #elif UNITY_ANDROID GoogleIAB.purchaseProduct(Constants.PRODUCT_ID); // GoogleIAB.purchaseProduct( "android.test.purchased" ); #endif }
void OnEnable() { #if UNITY_WEB_PLAYER || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN #else if (Debug.isDebugBuild) { Debug.Log("enabling google IAB"); } GoogleIABManager.consumePurchaseSucceededEvent += (purchase) => { GSApi.buyVirtualGoodFromStore(purchase.originalJson, purchase.signature); if (Debug.isDebugBuild) { Debug.Log("consumePurchaseSucceededEvent: " + purchase); } //GSApi.buyVirtualGoodFromStore(purchase.originalJson,purchase.signature); }; GoogleIABManager.consumePurchaseSucceededEvent += purchaseSucceededEvent; GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => { string[] products = new string[purchases.Count]; //var convertedProducts = new List<IAPProduct>(); for (int i = 0; i < purchases.Count; i++) { products[i] = purchases[i].productId; if (Debug.isDebugBuild) { Debug.Log(purchases[i].productId); } if (Debug.isDebugBuild) { Debug.Log(purchases[i].packageName); } } GoogleIAB.consumeProducts(products); }; GoogleIABManager.billingSupportedEvent += billingSupportedEvent; #endif }
// 구입 성공 완료 void purchaseSucceededEvent(GooglePurchase purchase) { LanguageManager thisLanguageManager = LanguageManager.Instance; Debug.Log("purchaseSucceededEvent: " + purchase); // 구입이 성공하면 불리는 함수. // 구입한 항목이 관리되지 않는 제품(캐시보석 같은) 놈이면, 요기서 소모를 시켜줌. 결재 성공했으니까. if (purchase.productId == "intotheblack.vip") { GameController.isVip = 1; PlayerPrefs.SetInt("isVip", GameController.isVip); resultWindow.GetComponent <StoreResult>().result = thisLanguageManager.GetTextValue("Store.Product1Result"); resultWindow.SetActive(true); } else if (purchase.productId == "intotheblack.venus") { GameController.wingMercury = 1; GameController.wingVenus = 1; PlayerPrefs.SetInt("mercury", GameController.wingMercury); PlayerPrefs.SetInt("venus", GameController.wingVenus); PlayerController.Instance.UpdateWing(); resultWindow.GetComponent <StoreResult>().result = thisLanguageManager.GetTextValue("Store.Product2Result"); resultWindow.SetActive(true); //script.UpdateWing(); } else if (purchase.productId == "intotheblack.shield") { Debug.Log("shield"); PlayerController.infinityShield = 1; PlayerPrefs.SetInt("infinityShield", PlayerController.infinityShield); } else { GoogleIAB.consumeProduct(purchase.productId); } // 아이템 넣는 처리는 죠 아래 소모 성공 함수가 실행되는 곳에서. void consumePurchaseSucceededEvent() }
public void Btn_Fun_Cash120() { Productid = "com.appsgraphy.kvsskakao.cash0100"; dicMenuList ["popup_buycash"].SetActive(true); GetTranjectionkey(); mProductCode = "1000007359"; mPaymentPrice = 10000; #if UNITY_ANDROID GoogleIAB.consumeProduct(Productid); #endif SetPopupPriceLabel("100", "9.99", "10,000"); //mRscrcMan.FindChild (dicMenuList ["popup_buycash"], "Label_num", true).GetComponent<UILabel> ().text = "100"; Ag.LogString(" MenuManager_Shop :: Btn_Fun_Cash120 >>> ProductID " + Productid); }
public virtual void init() { if (!paymentSystemAdded) { #if PURCHASE_USE_APPLE_ITUNES productManager = gameObject.AddComponent <StoreKitManager>(); productEventListener = gameObject.AddComponent <StoreKitEventListener>(); LogUtil.Log("ProductPurchase::InitPaymentSystem StoreKit/iOS added..."); GetProducts(); #elif PURCHASE_USE_AMAZON productManager = gameObject.AddComponent <AmazonIAPManager>(); productEventListener = gameObject.AddComponent <AmazonIAPEventListener>(); LogUtil.LogProduct("ProductPurchase::InitPaymentSystem Amazon IAP/Android added..."); #elif PURCHASE_USE_GOOGLE_PLAY productManager = gameObject.AddComponent <GoogleIABManager>(); productEventListener = gameObject.AddComponent <GoogleIABEventListener>(); LogUtil.LogProduct("ProductPurchase::InitPaymentSystem Google Play IAB/Android added..."); GoogleIAB.init(AppConfigs.productGoogleKey); #elif UNITY_WEBPLAYER LogUtil.LogProduct("ProductPurchase::InitPaymentSystem none added..."); #else LogUtil.LogProduct("ProductPurchase::InitPaymentSystem none added..."); #endif if (productManagerObject != null) { DontDestroyOnLoad(productManagerObject); } if (productEventListenerObject != null) { DontDestroyOnLoad(productEventListenerObject); } paymentSystemAdded = true; } }
public void FinishIAP() { UtilMgr.DismissLoading(); if (mIAPEvent.Response.code == 0) { #if (UNITY_ANDROID) GoogleIAB.consumeProduct(mItemcode); #else mDoneIAP(); #endif // mDoneIAP(); } else { //failed DialogueMgr.ShowDialogue(UtilMgr.GetLocalText("StrPurchaseFailed"), string.Format(UtilMgr.GetLocalText("StrPurchaseFailed2"), mItemname), DialogueMgr.DIALOGUE_TYPE.Alert, null); } }
//TODO private void QueryInventory() { //Add Original Skus Here List <string> prodIDs = new List <string>(); for (int i = 0; i < mInAppProducts.Count; i++) { prodIDs.Add(mInAppProducts[i].IAP_Id); } string[] skus = prodIDs.ToArray(); #if UNITY_ANDROID GoogleIAB.queryInventory(skus); #endif #if UNITY_IOS StoreKitBinding.requestProductData(skus); #endif }
void Init() { GoogleIABManager.billingSupportedEvent += billingSupportedEvent; GoogleIABManager.billingNotSupportedEvent += billingNotSupportedEvent; GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent; GoogleIABManager.queryInventoryFailedEvent += queryInventoryFailedEvent; GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent; GoogleIABManager.purchaseSucceededEvent += purchaseSucceededEvent; GoogleIABManager.purchaseFailedEvent += purchaseFailedEvent; GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent; GoogleIABManager.consumePurchaseFailedEvent += consumePurchaseFailedEvent; var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiAuaxUVegwS7YpWKYta7BluTgyLuh9wMR/ThKaVh8saH7Xl/eK0of3ilILzc/cs9LhW07uQeijQmxcMTiZI8pO5TfHuQCNSUZoK9dXJ1W0AzAj4He+Ur/XNEI3w0XSEUKAxQiFTbZ5x1/IoKH7LnvFWNqTKOmdRVSh45+G11qguABmHiT4PS0YTuUEfij1N4pkzJtNnfvTpwkx9mnCuO1e38659moGihHcwviKlv0W2ddb8te28iv5UxWSR2h9SWqHpjYFfv2Y2V9s1+F0MLb1fwbreAFocqmE+bHhV/oHVLBRv3Qsuwqej9CwRWU6YAwefjxmt0tEeDwHn2DF7gWQIDAQAB"; GoogleIAB.init(key); var skus = new string[] { "one.coin", "nineteen.coin", "three.coin", "five.coin", "nine.coin", "intotheblack.vip", "intotheblack.venus", "intotheblack.shield" }; GoogleIAB.queryInventory(skus); }
public void init(string key, string[] skus) { #if UNITY_ANDROID GoogleIAB.init(key); //copiedSkus = new string[skus.Length]; copiedSkus = skus; //GoogleIAB.queryInventory(skus); #elif UNITY_IPHONE bool canMakePayments = StoreKitBinding.canMakePayments(); if (canMakePayments) { StoreKitBinding.requestProductData(skus); } else { ShowMessages sm = new ShowMessages(); sm.ShowMessageWindow("ERROR ACCESSING APPLE STORE", "You can't connect to Apple Store, network error detected"); } #endif }
private void BeginCheckGooglePay(GameObject go) { if (lossLists.Count != 0) { GlobalSave.SOrder low = lossLists[0]; //在本地没有订单的情况下;至少帮助玩家添加订单;然后进行自动验证; if (!OrderManager.Instance().HaveOrder(low.strOder)) { BoxManager.showMessage("正在进行补单,请稍后", ""); OrderManager.Instance().AddOrder(low); PurchaseHelper.Instance().BeginCheckOrder(low, FinishCheck); } GoogleIAB.consumeProduct(low.productID); lossLists.RemoveAt(0); } else { GameObject.FindWithTag("main_controller").SendMessage("updateUserInfo"); } }
void ruby() { if (Application.platform == RuntimePlatform.IPhonePlayer) { // EventDelegate eventd = new EventDelegate(this, "purchaseInit"); // string prodList = ""; // foreach(ItemShopRubyInfo rubyInfo in getruby.Response.data){ // prodList += rubyInfo.productCode + ";"; // } IOSMgr.InAppInit(); } else if (Application.platform == RuntimePlatform.Android) { #if (UNITY_ANDROID) GoogleIAB.init(Constants.GOOGLE_PUBLIC_KEY); #endif } // } else{ GetAblePP(); // } }
//결제요청 하기 public void RequestPayment(string _productID, ushort _shopIdx) { UserEditor.Getsingleton.EditLog("purchase productID :" + _productID); UserEditor.Getsingleton.EditLog("purchase _shopIdx :" + _shopIdx); buyProductID = _productID; ShopIdx = _shopIdx; #if UNITY_ANDROID Loadmanager.instance.LoadingUI(true); GoogleIAB.purchaseProduct(_productID); #elif UNITY_IOS //구매진행중 ON isPurchasing = true; //로딩방 활성화 Loadmanager.instance.LoadingUI(true); StoreKitBinding.purchaseProduct(_productID, 1); #endif }
void Btn_Fun_CashBuyOk() { dicMenuList ["popup_buycash"].SetActive(false); #if UNITY_IPHONE AgStt.mIAP.TheUser = Ag.mySelf; AgStt.mIAP.PurchaseProduct(Productid); #endif #if UNITY_ANDROID AgStt.IntendedPause = true; if (Ag.CurStorePlfm == StorePlfm.GooglePlay) { GoogleIAB.purchaseProduct(Productid, GetUniqueKey(20)); } if (Ag.CurStorePlfm == StorePlfm.Nstore) { IABEventListener.CallPaymentNRequest(mProductCode, mPaymentPrice, GetUniqueKey(20)); } #endif }
void Start() { GetInAppIdsArrayForIOS(); #region iOS Methods #if UNITY_IOS && STOREKIT && !UNITY_EDITOR InvokeRepeating("RequestProduct", 0f, 15f); #endif #endregion // #region Android => Google Play Mathods #if UNITY_ANDROID && !AMAZONSTORE && !UNITY_EDITOR && GOOGLEIAB GoogleIAB.init("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAg1PP4V7cVb2kBIfWYcLYxx9OAXkT6/1EbfOxyI+hkvJN07mP/U1pmdfn8QIvCnCHA6gual2H1tUOu4DHUtwISnVWwSZqzNPYMsgVHEDMV+nC9/K09k+PNkL8PUaSRfg/wcUYyjOlRBNPXgNdzJ+KSYPrsFxdcY5pIdQYzYoO8kOCTfhJFTukPF+vtXMjtZBt2QppgMWtqSOGL79qk5buv9q15YLG6HN0XBTrK+dE2/2KbDZA58tiMMaGTqTTmHFRWZxtkvdosUf5xVofSsoR/3pevhJ9nZ2nhnFjzQiHUooKeUmCrsOzzWk6e80rXCPwrfWJaa1RKe0fgXz2wqCi8QIDAQAB"); #endif #endregion // #region Android => Amazon Store Methods #if UNITY_ANDROID && AMAZONSTORE && !UNITY_EDITOR iapService.GetUserData(); SkusInput sin = new SkusInput(); sin.Skus = new List <string>(); supportedMarketplaces = "USA, UK, Germany, Frane,\nSpain, Italy, Japan, Canada, Brazil, Australia"; #if UNDERGROUND supportedMarketplaces = "USA, UK, Germany, Frane"; #endif string sku = string.Empty; foreach (string s in InAppIDs) { sku = s; #if UNDERGROUND sku = sku.Replace("supercell.", "supercell.underground."); #endif sin.Skus.Add(sku); } iapService.GetProductData(sin); #endif #endregion }
public void SetIABListener() { GameObject gameObject = GameObject.Find("GoogleIABEventListener"); if (gameObject == null) { gameObject = new GameObject("GoogleIABEventListener"); gameObject.AddComponent <GoogleIABEventListener>(); } eSERVICE_AREA currentServiceArea = NrTSingleton <NrGlobalReference> .Instance.GetCurrentServiceArea(); if (TsPlatform.IsBand) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlcgaV+vJy5E2k/rPt5bqyL/c+0w+zomsHSYehTqDJKjLAmJb4Xa0TDTjGWs5s13LiH8P92pM8CgQ4H66evBarLAOnsGay218MsgxNFcoMQk3zr0zH0rYuR74/gVK0c2XEuipaqVRCtgFZxbjjmua80p49x0QEErHVOAbhOgNJFhTdS/JzWZY6hphkkfrJP5okwp9gV9dQOMxQFKJuGENx0Of7PxZ9aamZBipAWCX6bv2mAKUTZNLFR9uuiSnKb155hEKvfdzU7gJhFcUCEVIIVEpzM8NEDpGgiuxZVPS2vtBc2wrcDxbsCdGe/1jSyH/Gv6u1gIGZFSVMvMUyEfTDwIDAQAB"; } if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORGOOGLE) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiXp63SWTrJxRCsSR40TTSpo59MmdM4PKoEWCzfX9u4ZQmTGkZdZTYiIJ6Ti6T8JRW0x5J4aSDFLhnRCXZ/FpVABBiAJrMdaw5wtL7OLlY+aWplYBcfSvN/oodlaEl/ZMO1qfUWdmB3yn16ufKDUtQDKW56wDlsv5rT9vLJb1M6ySAXwY8WRu7LsatpWdciqU1NynwyIAtwwjqWTw9Fkh0tRHRjw+4cJhlzZRaoPKXeV255Qk83+hZ5MKiZveQZJy/SEYIa/CN3wCjmqJcMtgkbahv8lRc2XdCpiuevW++Rsrv6g9SNB4qUbLnh6+yO6DZsmbj4k60NaLjbusAj78mQIDAQAB"; } if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORQA) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjBAxIJFyvjdhpQm3BPkwR9qbmPSZU6vXnffk/CC42kaIdsJCAiyy+NoZOnqycKOsdVcCsoXI0gRlxmRo1OnZy3l7X6Z11dl9bNZeeZSzs6ra4pf/SGKxA/RqL2PyfO12O44hriPBuW2SzGGPWp9MoQgOREw8Tl0blRFjj6Qo6TGL+fkLsON67wZbOQInrP61ucOmumGdQ+14/agSrmPmRtLfNPelUzxEBGiM15vjjJtBd4vmD+1lqrLZBLlamT3adnpkqyu/qCeF5+i8qPW5yLLoOkpkvz6Mgbew9/NzlEWL/iPau38ylHb1YlToKEonzQYB8wURBviepFUBapYBiwIDAQAB"; } if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_KORKAKAO) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnGI8L7RnBfN/dKGdq4d2LfazJTMezVFksm+jJaEQBdSkz+WznSv8tROvRYO48LlZr891SjiKr4ucLu4CXmYAoMJ3ZrDSPz4p6uG3idjG9KBPLnQeC5CiKcxiZMAs3VkrhLMbds4My8+n8Fuw+caXGW9AwqhIX2jzs4OXHApOW7JK28erhp2AXKshD7z99vB82gz095Pa8X+eIGBhsLnYPP+eidCs+CFPtt9i1upuS3txG6VzvJgTSh3dFKsoFylaW/UIzLZJW7RY907QYNhgonmL/WwOesGUfjQdcjwurvmo0o7wPFvjkD3zoyZ+/UbMiYUE9io9r4rNKVbEkqK8GwIDAQAB"; } if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_USGOOGLE) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArcHJBFJXvvTCJ3Qaxqmj8r7btZHucb0UYyHxTv4sf7PAmNmKjwh03pSUz7vKZwxCIQdHcEcIzMuWbbhTFOyR8G3CqDsVZVmHzG1/F0m9iAvZ3mNcyuSzBf04gG6WpTjmJDEv8OEotBaAr9KH3akx20lmq4SxlknvWp7y36Xzv7IYfoX8lgdYn2hP2/qKCf0YwpMqngC7OCjA7Qol/3r9wP5JLSVQXM0ui2FiQJCAKYWmk2meL0FNBYLyk0v+FhnSxquG6JBeAmSSUwRkpR3EYqjh+Yq8rbKYfl8gQjX3uIyG5r1brtlC83d5Ycpvmj2v5CWqgslcrJcDSi/Z15O06QIDAQAB"; } if (currentServiceArea == eSERVICE_AREA.SERVICE_ANDROID_USQA) { this._key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnJ6vmwk1CUm5TsgY9UiWTHshNqz8hsu1swCrmHMNOb5WpKX/DLCy0g5imZSfKxe/3uMzwsuibA4EUNHmiHQBgaYhTPNxFd5o14IVSi4/KnMJyrP6qn7OfKdGV2hy/i8lfXUSrfgWUC+APkLvRxrQy2zzvPjfWoWiA+DsZ6i8KfIyyEIXJhEdi1RkH7rLwF3ZTJGWWQ4Ijdco5aQEbbRKP6SrX0weCkagQIRFmgKK4iMsVjwLvZbn7e8rlQTmr+nyfvjiMggS9OgL0/B5+NKpibL2LxN5/95PNqlhw6plDdGpIpuFdtXA7y4XavTzD6X/HQdtyvANcnJJReq/B1xAcQIDAQAB"; } UnityEngine.Object.DontDestroyOnLoad(gameObject); GoogleIAB.init(this._key); }
void GetCash() { WasInAppPrchs aObj = new WasInAppPrchs() { User = Ag.mySelf, }; aObj.messageAction = (int pInt) => { switch (pInt) { case 0: MainUserInfo(); Ag.LogString(" result : Success "); #if UNITY_ANDROID GoogleIAB.consumeProduct(Productid); #endif return; } }; }
void StartPurchase() { mPurchaseReady = false; // disable button when clicked KongregateAPI kongregate = KongregateAPI.GetAPI(); Dictionary <string, object> fields = new Dictionary <string, object> () { { "type", "Gold Pack" }, { "discount_percent", 12.5 }, { "context_of_offer", "StoreFront" } }; #if UNITY_IPHONE kongregate.Analytics.StartPurchase("com.kongregate.mobile.games.angryBots.t05_coins", 1, fields); StoreKitBinding.purchaseProduct("com.kongregate.mobile.games.angryBots.t05_coins", 1); #elif UNITY_ANDROID kongregate.Analytics.StartPurchase("com.kongregate.android.games.angrybots.t03_hard", 1, fields); GoogleIAB.purchaseProduct("com.kongregate.android.games.angrybots.t03_hard"); #elif UNITY_WEBPLAYER || UNITY_WEBGL kongregate.Analytics.StartPurchase("com.kongregate.web.angrybots.t05_hard", 1, fields); // Use the Javascript API to initiate the purchase. Notice in this flow we call finishPurchase via // the Javascript API after the purchase is completed by serializing the game fields needed. You // could also save the game fields into a variable in your Unity script and then call // kongregate.Analytics.FinishPurchase(...) in the Unity callback as well. Application.ExternalEval(string.Format( @"kongregate.mtx.purchaseItems(['com.kongregate.web.angrybots.t05_hard'], function(result){{ var status = result.success ? 'SUCCESS' : 'FAIL'; var data = result.success ? '{0}' : '{1}'; kongregate.analytics.finishPurchase(status, result.purchase_id, data); // Fire the callback in the Unity code kongregateUnitySupport.getUnityObject().SendMessage('Kongregate', 'OnKredPurchaseResult', status); }});" , Analytics.toAnalyticEventJSON(getPurchaseFields()), Analytics.toAnalyticEventJSON(fields))); #endif }
/// <summary> /// 팝업창 초기화 /// </summary> void InitPopupList() { #if UNITY_ANDROID GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore01_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore02_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore03_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore04_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore05_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore06_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore07_test"); GoogleIAB.consumeProduct("com.appsgraphy.kvsskakao.popupstore08_test"); var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" }; GoogleIAB.queryInventory(skus); #endif dicMenuList["PopupScoutPlayers"].SetActive(false); dicMenuList["PopupBuySoccerGloves"].SetActive(false); dicMenuList["PopupBuySoccerShoe"].SetActive(false); dicMenuList["PopupCardMixLuckTicket"].SetActive(false); dicMenuList ["PopupCardMixGradeReserveTicket"].SetActive(false); dicMenuList["PopupBuyEventCash"].SetActive(false); dicMenuList["PopupBuyPlayTimeaWeek"].SetActive(false); dicMenuList["PopupBuyPlayTimeaMonth"].SetActive(false); dicMenuList["PopupBuy_pop"].SetActive(false); dicMenuList["PopupExit_pop"].SetActive(false); }
protected void OnQueryInventorySucceeded(List <GooglePurchase> purchases, List <GoogleSkuInfo> skus) { GoogleIABManager.queryInventorySucceededEvent -= OnQueryInventorySucceeded; GoogleIABManager.queryInventoryFailedEvent -= OnQueryInventoryFailed; if (skus != null && skus.Count > 0) { Debug.Log("Product list received with " + skus.Count + " items."); productList = skus; receivedProductList = true; } if (purchases != null && purchases.Count > 0) { foreach (GooglePurchase purchase in purchases) { if (purchase.purchaseState == GooglePurchase.GooglePurchaseState.Purchased) { GoogleIAB.consumeProduct(purchase.productId); } } } }
public virtual void init() { if (!paymentSystemAdded) { #if PURCHASE_USE_APPLE_ITUNES_PRIME31 productManager = gameObject.Set <StoreKitManager>(); productEventListener = gameObject.Set <StoreKitEventListener>(); LogUtil.Log("ProductNetworks::InitPaymentSystem StoreKit/iOS added..."); GetProducts(); #elif PURCHASE_USE_AMAZON_PRIME31 productManager = gameObject.Set <AmazonIAPManager>(); productEventListener = gameObject.Set <AmazonIAPEventListener>(); LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Amazon IAP/Android added..."); #elif PURCHASE_USE_GOOGLE_PLAY_PRIME31 productManager = gameObject.Set <GoogleIABManager>(); productEventListener = gameObject.Set <GoogleIABEventListener>(); LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Google Play IAB/Android added..."); GoogleIAB.init(AppConfigs.productGoogleKey); #elif UNITY_WEBPLAYER LogUtil.LogProduct("ProductNetworks::InitPaymentSystem none added..."); #elif PURCHASE_USE_UNITY productManager = gameObject.Set <ProductNetworkUnity>(); LogUtil.LogProduct("ProductNetworks::InitPaymentSystem Unity added..."); #else LogUtil.LogProduct("ProductNetworks::InitPaymentSystem none added..."); #endif paymentSystemAdded = true; } }
private void IABQueryInventorySucceeded(List <GooglePurchase> arg1, List <GoogleSkuInfo> arg2) { List <string> skus = new List <string>(); if (arg1.Count > 1) { for (int i = 0; i < arg1.Count; i++) { string id = arg1[i].productId; IAPUnit iap = mInAppProducts.Find(prod => (prod.IAP_Id == id)); if (iap.mIAPtypes == IAP_Type.Consumable) { skus.Add(iap.IAP_Id); } else { NonConsumedSku.Add(iap.IAP_Id); } } GoogleIAB.consumeProducts(skus.ToArray()); } }
void OnEnable() { // Listen to all events for illustration purposes GoogleIABManager.billingSupportedEvent += billingSupportedEvent; GoogleIABManager.billingNotSupportedEvent += billingNotSupportedEvent; GoogleIABManager.queryInventorySucceededEvent += queryInventorySucceededEvent; GoogleIABManager.queryInventoryFailedEvent += queryInventoryFailedEvent; GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += purchaseCompleteAwaitingVerificationEvent; GoogleIABManager.purchaseSucceededEvent += purchaseSucceededEvent; GoogleIABManager.purchaseFailedEvent += purchaseFailedEvent; GoogleIABManager.consumePurchaseSucceededEvent += consumePurchaseSucceededEvent; GoogleIABManager.consumePurchaseFailedEvent += consumePurchaseFailedEvent; lossLists.Clear(); purchaseIds.Clear(); //var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1a3Da+i2nrPjYWPhFv065Qp+24xlP+hUcfkw/E1lDVCVq4z+Lu00tj3rR6sRUYTa5WsACxpFcFEtYJQWeRhNjdAXeyIZpbEOw0+5gyPRjQavLBQ6b1VHXXaAefAeVlCz0QfUv/DlW0zzFrlHN3O2z2Z5wWwzIvKzmJ/Euiev1KCvo6kMrawPXwAqWgur5c+fHBP58h2FKym2qbInSLN9tZdfoaTF7tDBDLl+Hrh8qwrLgwuJ9HzYRzD/oQ8Jh4VxgROBfMEh19U3/mLLc220J0lrqc5s+E2Mbl6V5kiq7lARyJGVVy29LR6Jm+Jbd9LbV+BwDOeOUdPTlE7POg1BzwIDAQAB"; var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm7QgZALTxa3KEHECIUKA4OKP9jf4D3mEYNyy01ikPjQFWQsl7tjgyiKMExroijekPx+GmdDmRNZzcYC/+QMNhet0MVmaxJprHZWv2vOuwZNW+a877obJhvDeNEz+x1fn4p6yNMntII+ZXZOihO5Lq54nHeoXDK67b58YOQ0YS4sEnQvoDlUjypAWY7f46BVDgxTOP+3oznF1yWavk7+M3Z+uV3SvJ0yKAoRErZVc/k9iJXHydzVgMM2n5QBr1sOJzJY1ip1VThLuXOu9brl0Dpl3PFlknK5dOyeDvMPw/nYcm//qEH5trwGp8Sk0pgy0bUE1MjE/J3PddhTuMxXvlQIDAQAB"; GoogleIAB.init(key); GoogleIAB.enableLogging(true); Debug.Log("add google play in application billing"); }
protected override void Purchase(MarketLot lot) { Debug.Log("AndroidBilling. Purchase lot:" + lot); GoogleIAB.purchaseProduct(lot.ProductAndroidIdentifier); }
private void ConsumeProduct(GooglePurchase purchase) { Debug.Log("Try consume product:" + purchase.productId); GoogleIAB.consumeProduct(purchase.productId); }
public void ConsumeProduct(string ProductId) { GoogleIAB.consumeProduct(ProductId); }
#pragma warning restore static IAP() { #if UNITY_IPHONE // product list StoreKitManager.productListReceivedEvent += (products) => { var convertedProducts = new List <IAPProduct>(); foreach (var p in products) { convertedProducts.Add(new IAPProduct(p)); } if (_productListReceivedAction != null) { _productListReceivedAction(convertedProducts); } }; StoreKitManager.productListRequestFailedEvent += (error) => { Debug.Log("fetching prouduct data failed: " + error); if (_productListReceivedAction != null) { _productListReceivedAction(null); } }; // purchases StoreKitManager.purchaseSuccessfulEvent += (transaction) => { if (_purchaseCompletionAction != null) { _purchaseCompletionAction(true); moneyPurchasedWithKey(transaction.productIdentifier); // purchase successfull } if (_purchaseRestorationAction != null) { _purchaseRestorationAction(transaction.productIdentifier); } }; StoreKitManager.purchaseFailedEvent += (error) => { Debug.Log("purchase failed: " + error); if (_purchaseCompletionAction != null) { _purchaseCompletionAction(false); } }; StoreKitManager.purchaseCancelledEvent += (error) => { Debug.Log("purchase cancelled: " + error); if (_purchaseCompletionAction != null) { _purchaseCompletionAction(false); } }; // restoration StoreKitManager.restoreTransactionsFailedEvent += (error) => { Debug.Log("restore transactions failed: " + error); // we null out the _purchaseRestorationAction so that it won't get called if the user later purchases a product _purchaseRestorationAction = null; }; #elif UNITY_ANDROID // inventory GoogleIABManager.queryInventorySucceededEvent += (purchases, skus) => { // Android is a bit different and stores purchased items for later consumption so we save off those items here androidPurchasedItems = purchases; for (int i = 0; i < androidPurchasedItems.Count; i++) { if (androidPurchasedItems[i].productId == (IAPComboUI.androidSkus [0])) { GoogleIAB.consumeProduct(IAPComboUI.androidSkus [0]); } else if (androidPurchasedItems[i].productId == (IAPComboUI.androidSkus [1])) { GoogleIAB.consumeProduct(IAPComboUI.androidSkus [1]); } else if (androidPurchasedItems[i].productId == (IAPComboUI.androidSkus [2])) { GoogleIAB.consumeProduct(IAPComboUI.androidSkus [2]); } else if (androidPurchasedItems[i].productId == (IAPComboUI.androidSkus [3])) { GoogleIAB.consumeProduct(IAPComboUI.androidSkus [3]); } else if (androidPurchasedItems[i].productId == (IAPComboUI.androidSkus [4])) { GoogleIAB.consumeProduct(IAPComboUI.androidSkus [4]); } } var convertedProducts = new List <IAPProduct>(); foreach (var p in skus) { convertedProducts.Add(new IAPProduct(p)); } if (_productListReceivedAction != null) { _productListReceivedAction(convertedProducts); } }; GoogleIABManager.queryInventoryFailedEvent += (error) => { Debug.Log("fetching prouduct data failed: " + error); if (_productListReceivedAction != null) { _productListReceivedAction(null); } }; // purchases GoogleIABManager.purchaseSucceededEvent += (purchase) => { if (purchase.developerPayload == NON_CONSUMABLE_PAYLOAD) { if (_purchaseCompletionAction != null) { _purchaseCompletionAction(true); } } else { // we need to consume this one GoogleIAB.consumeProduct(purchase.productId); moneyPurchasedWithKey(purchase.productId); // purchase successfull } }; // GoogleIABManager.purchaseFailedEvent += ( error ) => /*{ * Debug.Log( "purchase failed: " + error ); * if( _purchaseCompletionAction != null ) * _purchaseCompletionAction( false ); * }; */ // consumption GoogleIABManager.consumePurchaseSucceededEvent += (purchase) => { if (_purchaseCompletionAction != null) { _purchaseCompletionAction(true); } }; GoogleIABManager.consumePurchaseFailedEvent += (error) => { if (_purchaseCompletionAction != null) { _purchaseCompletionAction(false); } }; #endif }