示例#1
0
    public override void PurchaseProduct(InAppPurchase purchase)
    {
#if UNITY_EDITOR
        base.PurchaseProduct(purchase);
#elif UNITY_ANDROID
        if (!billingSupported)
        {
            RequestProductList();             //try to check again

            OnInAppDisabled(purchase);
        }
        else
        {
            purchasingProduct = purchase;

            RequestProductList();

            GoogleIABManager.purchaseCompleteAwaitingVerificationEvent += OnProductAwaitingVerificationAndroid;
            GoogleIABManager.purchaseSucceededEvent += OnVerificationSuccess;
            GoogleIABManager.purchaseFailedEvent    += OnProductFailed;

            Debug.Log("Purchasing product: " + GetPurchaseId(purchase));
            GoogleIAB.purchaseProduct(GetPurchaseId(purchase));
        }
#endif
    }
    /// <summary>
    /// 이벤트 팝업으로 최종적으로 구매할때 부르는 함수
    /// </summary>
    void PopupPurchaseAction()
    {
        #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

        /*
         * WasPopupPurchase aObj = new WasPopupPurchase () { PopupCode = popupCode ,User = Ag.mySelf };
         * aObj.messageAction = (int pInt) => {
         *  switch (pInt) { // 0 : 성공, -1 : 중복, -2 : 허용 불가 이름, 1: 존재하지 않는 사용자
         *  case 0:
         *      PopupAfterPurchaseAction ();
         *      break;
         *  case 1:
         *      MenuCommonOpen ("Ui_popup", "havenotcash", false);
         *      break;
         *  }
         *  aObj = null;
         * };
         */
    }
示例#3
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES_PRIME31
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON_PRIME31
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY_PRIME31
        GoogleIAB.purchaseProduct(code);
#elif PURCHASE_USE_UNITY
        productManager.PurchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductNetworkRecord data =
            ProductNetworkRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductNetworkType.typeThirdParty,
                ProductNetworkStoreType.typeAmazon,
                ProductNetworkConsumableType.consumable);

        BroadcastProductNetworksSuccess(data);
#endif
    }
示例#4
0
    public void purchaseProduct(string code, int quantity)
    {
#if PURCHASE_USE_APPLE_ITUNES
        StoreKitBinding.purchaseProduct(code, quantity);
#elif PURCHASE_USE_AMAZON
        //AmazonIAP.initiatePurchaseRequest(GamePacks.currentGameBundle + "." + code);
        AmazonIAP.initiatePurchaseRequest(code);
#elif PURCHASE_USE_GOOGLE_PLAY
        GoogleIAB.purchaseProduct(code);
#else
        // Web/PC
        purchaseProcessCompleted = true;

        ProductPurchaseRecord data =
            ProductPurchaseRecord.Create(
                code,
                "Product Purchase",
                "Product purchased:" + code,
                true,
                "TODO",
                "TODO",
                code,
                1,
                ProductPurchaseType.typeThirdParty,
                ProductStoreType.typeAmazon);

        BroadcastProductPurchaseSuccess(data);
#endif
    }
示例#5
0
    public void purchaseProduct(string product)
    {
#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(product);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(product, 1);
#else
/*        string url = UI.Instance.getURL(product);
 *      FB.Canvas.Pay(url, "purchaseitem", 1, null, null, null, null, null, delegate(FBResult response) {
 *          object resp = Json.Deserialize(response.Text);
 *          Dictionary<string, object> infoItem = resp as Dictionary<string, object>;
 *          if (infoItem != null) {//HACKKKAKAKAKKAKKA
 *              //if (product == "com.bitoon.classicgolf.punadogemas") { //joyero
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0ODI2NDgwMTUsImFtb3VudCI6IjEwLjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6Imx2Zkg3Smt2ajY3MjJPMTVVRE9KNkU5UjdpNlFNczRTajJLUVRQdU9JYVEuZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpFd0xqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEV5T0RBc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTRNalkwT0RBeE5Td2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.bolsagemas") {  //saco
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0ODkzMTQ2ODEsImFtb3VudCI6IjI1LjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6IjZyMW8yX1IxQ1pOdHlHeUdvZXdGYjlKbTZ3WUxxV3FIajYzRWl1SHlBLW8uZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpJMUxqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEV6TkRZc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTRPVE14TkRZNE1Td2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.joyerogemas") {//cofre
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg0OTI2NDgwMTQsImFtb3VudCI6IjUwLjAwIiwiY3VycmVuY3kiOiJFVVIiLCJxdWFudGl0eSI6IjEiLCJzdGF0dXMiOiJjb21wbGV0ZWQiLCJzaWduZWRfcmVxdWVzdCI6Ill3eEJTM2p2WWlrVjdQbVhJemM5STluSUZoMklwaWw1Z3p4Y0UwNUNJTEUuZXlKaGJHZHZjbWwwYUcwaU9pSklUVUZETFZOSVFUSTFOaUlzSW1GdGIzVnVkQ0k2SWpVd0xqQXdJaXdpWTNWeWNtVnVZM2tpT2lKRlZWSWlMQ0pwYzNOMVpXUmZZWFFpT2pFek9UZ3lOVEUwTWpJc0luQmhlVzFsYm5SZmFXUWlPalEwTVRRNE9EUTVNalkwT0RBeE5Dd2ljWFZoYm5ScGRIa2lPaUl4SWl3aWMzUmhkSFZ6SWpvaVkyOXRjR3hsZEdWa0luMCJ9");
 *              //} else if (product == "com.bitoon.classicgolf.sacogemas") { // camion
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "eyJwYXltZW50X2lkIjo0NDE0ODg1MzkzMTQ2NzYsImFtb3VudCI6IjEwMC4wMCIsImN1cnJlbmN5IjoiRVVSIiwicXVhbnRpdHkiOiIxIiwic3RhdHVzIjoiY29tcGxldGVkIiwic2lnbmVkX3JlcXVlc3QiOiJWUWR6eXBKMnBETGoyU0lBZ0NoaGd5NThwTUtFdW9IeWVFOW52cTROcjkwLmV5SmhiR2R2Y21sMGFHMGlPaUpJVFVGRExWTklRVEkxTmlJc0ltRnRiM1Z1ZENJNklqRXdNQzR3TUNJc0ltTjFjbkpsYm1ONUlqb2lSVlZTSWl3aWFYTnpkV1ZrWDJGMElqb3hNems0TWpVeU16UXpMQ0p3WVhsdFpXNTBYMmxrSWpvME5ERTBPRGcxTXprek1UUTJOellzSW5GMVlXNTBhWFI1SWpvaU1TSXNJbk4wWVhSMWN5STZJbU52YlhCc1pYUmxaQ0o5In0=");
 *              //} else if (product == "com.bitoon.classicgolf.cofregemas") { //000000
 *              //    //purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
 *              //} else ;
 *              ////purchaseHardCurrency(product, "facebook", LoadXmlData.baseUrl + "/golfws/rest/market/exchange", "",Convert.ToBase64String(Encoding.UTF8.GetBytes(response.Text)));
 *          }
 *     });
 */
#endif
    }
示例#6
0
    public static void buyItem(string itemID)
    {
#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(itemID);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(itemID, 1);
#endif
    }
示例#7
0
        //
        void IABQueryInventorySucceeded(List <GooglePurchase> purchases, List <GoogleSkuInfo> skus)
        {
            GameUtility.Me.HideProgressDialog();
            MyDebug.Log("InAppManager::IABQueryInventorySucceeded => " + purchases.Count + " : " + skus.Count);
            if (purchases == null || skus == null)
            {
                MyDebug.Log("Not able to retrive product list from Google, please try after some time.");
                PopupMessages.Me.PurchaseFailMessage();
                CoreUtility.Me.OnInAppFail(pID);
                return;
            }

            if (purchases.Count <= 0 && !isRestore)
            {
                //Fresh Purchase
                GoogleIAB.purchaseProduct(pID);
            }
            else if (purchases.Count > 0 && !isRestore)
            {
                //Conuseme and Purchase
                for (int i = 0; i < purchases.Count; i++)
                {
                    if (!NON_CONSU_PRODUCTS.Contains("," + purchases[i].productId + ","))
                    {
                        GoogleIAB.consumeProduct(purchases[i].productId);
                    }
                    else if (pID == purchases[i].productId)
                    {
                        PurchaseSuccessful(purchases[i].productId, purchases[i].orderId);
                        return;
                    }
                }
                GoogleIAB.purchaseProduct(pID);
            }
            else if (isRestore && purchases.Count > 0)
            {
                //Restore
                for (int i = 0; i < purchases.Count; i++)
                {
                    if (!NON_CONSU_PRODUCTS.Contains("," + purchases[i].productId + ","))
                    {
                        GoogleIAB.consumeProduct(purchases[i].productId);
                    }
                    else
                    {
                        PurchaseSuccessful(purchases[i].productId, purchases[i].orderId);
                    }
                }
                PopupMessages.Me.RestoreSuccessfulMessage();
                isRestore = false;
            }
            else if (purchases.Count <= 0 && isRestore)
            {
                MyDebug.Log("Nothing to Restore");
                PopupMessages.Me.NothingToRestoreMessage();
                isRestore = false;
            }
        }
示例#8
0
 /// <summary>
 /// purchase non-consumable product based on its product id.
 /// Our delegates then fire the appropriate succeeded/fail event.
 /// Additionally, non-consumables are being saved to the database
 /// </summary>
 public static void PurchaseNonconsumableProduct(string productId)
 {
     productId = GetIAPObject(productId).GetIdentifier();
     #if UNITY_ANDROID
     GoogleIAB.purchaseProduct(productId, "nonconsume");
     #elif UNITY_IPHONE
     StoreKitBinding.purchaseProduct(productId, 1);
     #endif
 }
示例#9
0
    // Purchases the given product and quantity. completionHandler provides if the purchase succeeded
    public static void purchaseNonconsumableProduct(string productId, Action <bool> completionHandler)
    {
        _purchaseCompletionAction = completionHandler;

#if UNITY_ANDROID
        GoogleIAB.purchaseProduct(productId, NON_CONSUMABLE_PAYLOAD);
#elif UNITY_IPHONE
        StoreKitBinding.purchaseProduct(productId, 1);
#endif
    }
示例#10
0
    IEnumerator WaitingForPurchase()
    {
        yield return(new WaitForSeconds(0.5f));

                #if (UNITY_ANDROID)
        GoogleIAB.purchaseProduct(mItemcode);
                #else
        IOSMgr.BuyItem(mItemcode);
                #endif
    }
示例#11
0
    void Update()
    {
        base.Update();

        if (m_btnBuy.ButtonPushed)
        {
            m_btnBuy.TriggerClear();
            GoogleIAB.purchaseProduct(m_csvVoiceData.name_voice);
        }
    }
示例#12
0
    public static void buyItem(string productId)
    {
        instance.m_bPurchased = false;
        instance.m_eStatus    = STATUS.BUYING;

                #if UNITY_IPHONE
        IOSInAppPurchaseManager.Instance.BuyProduct(productId);
                #elif UNITY_ANDROID
        GoogleIAB.purchaseProduct(productId);
                #endif
    }
 public static void purchaseGooglePlay(string productID)
 {
     if (!isBillingSupported)
     {
         Debug.Log("google billing is not supported");
         //BoxManager.showMessage("該手機不支持GooglePlay支付,請選擇其他支付","溫馨提示");
         return;
     }
     Debug.Log("GooglePlayManager purchaseGooglePla sku:" + productID);
     GoogleIAB.purchaseProduct(productID, "payload that gets stored and returned");
 }
示例#14
0
 public override void PurchaseItem(string strItem, int price)
 {
     NrTSingleton <NrMainSystem> .Instance.m_bIsBilling = true;
     if (this.m_PurchaseList.ContainsKey(strItem))
     {
         Main_UI_SystemMessage.ADDMessage(NrTSingleton <NrTextMgr> .Instance.GetTextFromNotify("664"));
         return;
     }
     GoogleIAB.purchaseProduct(strItem, string.Format("1{0:yyMMddHHmmss}_{1}", DateTime.Now, NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_PersonID));
     this.BuyItem = strItem;
 }
示例#15
0
    public void BuyProduct(IAP iap)
    {
        IAPUnit mIap = mInAppProducts.Find(f => (f.mIap == iap));

        #if UNITY_ANDROID
        GoogleIAB.purchaseProduct(mIap.IAP_Id);
        #endif

        #if UNITY_IOS
        StoreKitBinding.purchaseProduct(mIap.IAP_Id, 1);
        #endif
    }
示例#16
0
 public void Purchase(string productId)
 {
             #if UNITY_ANDROID
     if (ShopEvents.purchasedProductIds.Contains(productId))
     {
         GoogleIAB.consumeProduct(productId);
     }
     else
     {
         GoogleIAB.purchaseProduct(productId);
     }
             #endif
 }
示例#17
0
    new void Update()
    {
        base.Update();

        if (m_btnBuy.ButtonPushed)
        {
            m_btnBuy.TriggerClear();
            Debug.Log(string.Format("purchace_id:{0}", m_csvVoiceData.name_voice));
                        #if RAKUTEN
            RakutenBilling.Instance.purchaseProduct(m_csvVoiceData.name_voice);
                        #else
            GoogleIAB.purchaseProduct(m_csvVoiceData.name_voice);
                        #endif
        }
    }
示例#18
0
 public void RestorePurchase()
 {
     Main.Instance.PlayButtonSound();
     isRestoring = true;
             #if UNITY_IOS
     StoreKitBinding.restoreCompletedTransactions();
             #elif UNITY_ANDROID
     if (canRestored)
     {
         Debug.Log("Restored Purchase");
         //			GoogleIAB.purchaseProduct(Constants.PRODUCT_ID, "NoAds");
         GoogleIAB.purchaseProduct(Constants.PRODUCT_ID);
     }
             #endif
 }
示例#19
0
 /// <summary>
 /// purchase subscription based on its product id.
 /// Our delegates then fire the appropriate succeeded/fail event.
 /// On Android we have to check whether subscriptions are supported
 /// </summary>
 public static void PurchaseSubscription(string productId)
 {
     productId = GetIAPObject(productId).GetIdentifier();
     #if UNITY_ANDROID
     if (GoogleIAB.areSubscriptionsSupported())
     {
         GoogleIAB.purchaseProduct(productId);
     }
     else
     {
         BillingNotSupported("Subscriptions not available.");
     }
     #elif UNITY_IPHONE
     StoreKitBinding.purchaseProduct(productId, 1);
     #endif
 }
示例#20
0
 /// <summary>
 /// purchase consumable product based on its product id.
 /// If the productId matches "restore", we restore iaps instead.
 /// Our delegates then fire the appropriate succeeded/fail event
 /// </summary>
 public static void PurchaseConsumableProduct(string productId)
 {
     if (productId == "restore")
     {
         RestoreTransactions();
     }
     else
     {
         productId = GetIAPObject(productId).GetIdentifier();
         #if UNITY_ANDROID
         GoogleIAB.purchaseProduct(productId, "consume");
         #elif UNITY_IPHONE
         StoreKitBinding.purchaseProduct(productId, 1);
         #endif
     }
 }
示例#21
0
//	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
    }
示例#22
0
    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 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
    }
    //결제요청 하기
    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
    }
示例#25
0
        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
        }
示例#26
0
//	public void PurchaseConsume(string productname)
//	{
//		GoogleIAB.consumeProduct(productname);
//	}

    public void PurchaseManaged(string productname)
    {
        SoundManager.Instance.PlaySound(8);
        GoogleIAB.purchaseProduct(productname);
    }
示例#27
0
 protected override void Purchase(MarketLot lot)
 {
     Debug.Log("AndroidBilling. Purchase lot:" + lot);
     GoogleIAB.purchaseProduct(lot.ProductAndroidIdentifier);
 }
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Initialize IAB"))
        {
            var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4RxjBkG9CEW7Z/ug+F739LXkLiTO6+Igv/2h4WqsYzLUzJJC0RBG4EsKT5LepByCSZ3AD+mBIe13kKQJisLmgtlTspkiEwCqX+oJEpm7FN2iRZX9h7EtE/p/2B2K/hFCUJqe44nliRwUhnmTo7+5v8jy2osNASATAwU4CWr+RlCZ+DnWiDM0WqnIqSiSkluSnay4zYfKzD9zsv7tfj1EYyV96RefYDV+xaBP7F43z9//SfZ5EwNtt/pjzY3y/F5hOCY0YM2foMp5JELZOHHLtTFXMtBvuO5RW62ze+h10T1kcwWAzf19aXHr3AwuKByD94C5ghPVUm/p4M1ZXdEAwIDAQAB";
            //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";
            GoogleIAB.init(key);
        }


        if (GUILayout.Button("Query Inventory"))
        {
            // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
            GoogleIAB.queryInventory(skus);
        }


        if (GUILayout.Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
        }


        if (GUILayout.Button("Purchase Test Product"))
        {
            GoogleIAB.purchaseProduct("test003");
        }


        if (GUILayout.Button("Consume Test Purchase"))
        {
            GoogleIAB.consumeProduct("test003");
        }


        if (GUILayout.Button("Test Unavailable Item"))
        {
            GoogleIAB.purchaseProduct("android.test.item_unavailable");
        }


        endColumn(true);


        if (GUILayout.Button("Purchase Real Product"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
        }


        if (GUILayout.Button("Purchase Real Subscription"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
        }


        if (GUILayout.Button("Consume Real Purchase"))
        {
            GoogleIAB.consumeProduct("com.prime31.testproduct");
        }


        if (GUILayout.Button("Enable High Details Logs"))
        {
            GoogleIAB.enableLogging(true);
        }


        if (GUILayout.Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
            GoogleIAB.consumeProducts(skus);
        }

        endColumn();
    }
示例#29
0
 public static void purchaseProduct(string sku)
 {
     GoogleIAB.purchaseProduct(sku, string.Empty);
 }
示例#30
0
    void OnGUI()
    {
        beginColumn();

        if (GUILayout.Button("Initialize IAB"))
        {
            var key = "your public key from the Android developer portal here";
            key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmffbbQPr/zqRjP3vkxr1601/eKsXm5kO2NzQge8m7PeUj5V+saeounyL34U8WoZ3BvCRKbw6DrRLs2DMoVuCLq7QtJggBHT/bBSHGczEXGIPjWpw6OQb24EWM0PaTRTH2x2mC/X6RwIKcPLJFmy68T38Eh0DXnF4jjiIoaD0W8AYLjLzv0WvbIfgtJlvmmwvI2/Kta1LRnW3/Ggi5jb9UmXZAUIBz8kQtSH5FUCmFOQHMzekfg8rQ4VO1nlWhnB58UPwsxWt/DNyDfqv2VMeA2+VJG0fkiMl/6vWA7+ianVTU3owXcvxJHseEDUVYo1wEKfhK7ErGB7sxDJx5wHXAwIDAQAB";
            GoogleIAB.init(key);
        }


        if (GUILayout.Button("Query Inventory"))
        {
            // enter all the available skus from the Play Developer Console in this array so that item information can be fetched for them
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased", "com.prime31.managedproduct", "com.prime31.testsubscription" };
            GoogleIAB.queryInventory(skus);
        }


        if (GUILayout.Button("Are subscriptions supported?"))
        {
            Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported());
        }


        if (GUILayout.Button("Purchase Test Product"))
        {
            GoogleIAB.purchaseProduct("android.test.purchased");
        }


        if (GUILayout.Button("Consume Test Purchase"))
        {
            GoogleIAB.consumeProduct("android.test.purchased");
        }


        if (GUILayout.Button("Test Unavailable Item"))
        {
            GoogleIAB.purchaseProduct("android.test.item_unavailable");
        }


        endColumn(true);


        if (GUILayout.Button("Purchase Real Product"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testproduct", "payload that gets stored and returned");
        }


        if (GUILayout.Button("Purchase Real Subscription"))
        {
            GoogleIAB.purchaseProduct("com.prime31.testsubscription", "subscription payload");
        }


        if (GUILayout.Button("Consume Real Purchase"))
        {
            GoogleIAB.consumeProduct("com.prime31.testproduct");
        }


        if (GUILayout.Button("Enable High Details Logs"))
        {
            GoogleIAB.enableLogging(true);
        }


        if (GUILayout.Button("Consume Multiple Purchases"))
        {
            var skus = new string[] { "com.prime31.testproduct", "android.test.purchased" };
            GoogleIAB.consumeProducts(skus);
        }

        endColumn();
    }