public void PurchaseProduct(string sku) { WriteLog("starting purchase: {0}", sku); if (_state == State.Busy) { CompleteTask(Failed, "can't purchase product", "busy"); } else { _sku = sku; _state = State.Busy; if (_state == State.Ready) { WriteLog("quering inventory..."); OpenIAB.queryInventory(); } else { WriteLog("initializing OpenIAB..."); OpenIAB.init(_options); } } }
private void billingSupportedEvent() { _isInitialized = true; mainTapjoy.BillingInitalized(); OpenIAB.queryInventory(new string[] { SKU }); }
public void Restore() { WriteLog("starting restore..."); if (_state == State.Busy) { CompleteTask(Failed, "can't restore purchases", "busy"); } else { _sku = null; _state = State.Busy; if (_state == State.Ready) { WriteLog("quering inventory..."); OpenIAB.queryInventory(); } else { WriteLog("initializing OpenIAB..."); OpenIAB.init(_options); } } }
private void billingSupportedEvent() { _isInitialized = true; OpenIAB.queryInventory(); _label = "billingSupportedEvent"; Debug.Log("billingSupportedEvent"); }
private void OnBillingSupported() { //Debug.Log("Billing is supported"); OpenIAB.queryInventory(new string[] { SKU_money_10k }); OpenIAB.queryInventory(new string[] { SKU_money_25k }); OpenIAB.queryInventory(new string[] { SKU_money_50k }); OpenIAB.queryInventory(new string[] { SKU_money_100k }); OpenIAB.queryInventory(new string[] { SKU_money_1mln }); }
// private void OnGUI() { // float yPos = 5.0f; // float xPos = 5.0f; // float width = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160; // float height = (Screen.width >= 800 || Screen.height >= 800) ? 80 : 40; // float heightPlus = height + 10.0f; // //// if (GUI.Button(new Rect(xPos, yPos, width, height), "Initialize OpenIAB")) { //// // Application public key //// var public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB"; //// //// var options = new Options(); //// options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; //// options.storeKeys = new Dictionary<string, string> { //// {OpenIAB_Android.STORE_GOOGLE, public_key} //// }; //// //// // Transmit options and start the service //// OpenIAB.init(options); //// } // // if (!_isInitialized) // return; // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase")) { // OpenIAB.purchaseProduct("android.test.purchased"); // } // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund")) { // OpenIAB.purchaseProduct("android.test.refunded"); // } // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable")) { // OpenIAB.purchaseProduct("android.test.item_unavailable"); // } // // xPos = Screen.width - width - 5.0f; // yPos = 5.0f; // // if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled")) { // OpenIAB.purchaseProduct("android.test.canceled"); // } // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory")) { // OpenIAB.queryInventory(new string[] { SKU }); // } // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product")) { // OpenIAB.purchaseProduct(SKU); // } // // if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Consume Real Product")) { // OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU)); // } // } #endif #if UNITY_WP8 void OnGUI() { if (GUI.Button(new Rect(10, 10, Screen.width * 0.3f, Screen.height * 0.1f), "QUERY INVENTORY")) { OpenIAB.queryInventory(new string[] { SKU_AMMO, SKU_MEDKIT, SKU_SUBSCRIPTION }); } if (GUI.Button(new Rect(20 + Screen.width * 0.3f, 10, Screen.width * 0.3f, Screen.height * 0.1f), "Purchase")) { OpenIAB.purchaseProduct(SKU_MEDKIT); } if (GUI.Button(new Rect(30 + Screen.width * 0.6f, 10, Screen.width * 0.3f, Screen.height * 0.1f), "Consume")) { OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU_MEDKIT)); } GUI.Label(new Rect(10, 20 + Screen.height * 0.1f, Screen.width, Screen.height), _label); }
private void purchaseSucceededEvent(Purchase purchase) { Debug.Log("purchaseSucceededEvent: " + purchase); _label = "PURCHASED:" + purchase.ToString(); if (_inventory != null) { var sk = _inventory.GetSkuDetails(purchase.Sku); var pr = 0f; float.TryParse(sk.PriceValue, out pr); pr *= 100; AnalyticsManager.TrackBusinessEvent(sk.CurrencyCode, (int)pr, "pack", sk.Title, "shop"); Debug.Log("Purchase analytics sent"); } purchaseSucceeded(purchase.Sku); OpenIAB.queryInventory(); }
private void FixedUpdate() { if (ClickedPurchase.tapped) { ClickedPurchase.tapped = false; OpenIAB.queryInventory(new string[] { SKU }); //OpenIAB.purchaseProduct("missileman.paid"); } if (ClickedPurchase.query) { ClickedPurchase.query = false; OpenIAB.queryInventory(new string[] { SKU }); query = true; } // else if(ClickedRemove.tapped) // { // ClickedRemove.tapped = false; // PlayerPrefs.SetInt("p1a5I8d", 0); // } }
private void OnBillingSupported() { Debug.Log("Billing is supported"); OpenIAB.queryInventory(); }
// when billing is supported on the device, // this method requests IAP product data from Google/Apple private void RequestProductData() { OpenIAB.queryInventory(ids); }
private void OnGUI() { _column = 0; _row = 0; GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE; if (Button("Initialize OpenIAB")) { // Application public key var publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgEEaiFfxugLWAH4CQqXYttXlj3GI2ozlcnWlZDaO2VYkcUhbrAz368FMmw2g40zgIDfyopFqETXf0dMTDw7VH3JOXZID2ATtTfBXaU4hqTf2lSwcY9RXe/Uz0x1nf1oLAf85oWZ7uuXScR747ekzRZB4vb4afm2DsbE30ohZD/WzQ22xByX6583yYE19RdE9yJzFckEPlHuOeMgKOa4WErt11PHB6FTdT5eN96/jjjeEoYhX/NGkOWKW0Y0T0A7CdUC0D4t2xxkzAQHdgLfcRw9+/EIcaysLhncWYiCifJrRBGpqZU1IrNuehrC5FXUN99786c/TwlxNG5nflE6sWwIDAQAB"; var options = new Options(); options.checkInventoryTimeoutMs = Options.INVENTORY_CHECK_TIMEOUT_MS * 2; options.discoveryTimeoutMs = Options.DISCOVER_TIMEOUT_MS * 2; options.checkInventory = false; options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; options.prefferedStoreNames = new string[] { OpenIAB_Android.STORE_GOOGLE }; options.availableStoreNames = new string[] { OpenIAB_Android.STORE_GOOGLE }; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_GOOGLE, publicKey } }; options.storeSearchStrategy = SearchStrategy.INSTALLER_THEN_BEST_FIT; // Transmit options and start the service OpenIAB.init(options); } if (!_isInitialized) { return; } if (Button("Query Inventory")) { OpenIAB.queryInventory(new string[] { SKU }); } if (Button("Purchase Product")) { OpenIAB.purchaseProduct(SKU); } if (Button("Consume Product")) { if (_inventory != null && _inventory.HasPurchase(SKU)) { OpenIAB.consumeProduct(_inventory.GetPurchase(SKU)); } } // Android specific buttons #if UNITY_ANDROID if (Button("Test Purchase")) { OpenIAB.purchaseProduct("android.test.purchased"); } if (Button("Test Consume")) { if (_inventory != null && _inventory.HasPurchase("android.test.purchased")) { OpenIAB.consumeProduct(_inventory.GetPurchase("android.test.purchased")); } } if (Button("Test Item Unavailable")) { OpenIAB.purchaseProduct("android.test.item_unavailable"); } if (Button("Test Purchase Canceled")) { OpenIAB.purchaseProduct("android.test.canceled"); } #endif }
private void OnBillingSupported() { Debug.Log("Billing is supported"); OpenIAB.queryInventory(new string[] { SKU_10, SKU_50, SKU_100, SKU_Life }); }
private void OnGUI() { _column = 0; _row = 0; GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE; if (Button("Initialize OpenIAB")) { // Application public key var googlePublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgEEaiFfxugLWAH4CQqXYttXlj3GI2ozlcnWlZDaO2VYkcUhbrAz368FMmw2g40zgIDfyopFqETXf0dMTDw7VH3JOXZID2ATtTfBXaU4hqTf2lSwcY9RXe/Uz0x1nf1oLAf85oWZ7uuXScR747ekzRZB4vb4afm2DsbE30ohZD/WzQ22xByX6583yYE19RdE9yJzFckEPlHuOeMgKOa4WErt11PHB6FTdT5eN96/jjjeEoYhX/NGkOWKW0Y0T0A7CdUC0D4t2xxkzAQHdgLfcRw9+/EIcaysLhncWYiCifJrRBGpqZU1IrNuehrC5FXUN99786c/TwlxNG5nflE6sWwIDAQAB"; var yandexPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApvU8l4ONEEsSGznPN6DnjIbJnv6vEgm08nbbi+2fMc0V46N7x7jBWTWAf2K6XLZg/rLUkqbWISq12PLvt7ydcsD+Hb9ZubdN2h8LNCTohVPeDbJjd5khtF4J5FNP2/XSTc1C7cSCBTGmqH0fUr77v4x/JMpxKlSjPN6KbNnaF2BLDAdi3012lz2XX4BVgUj7LArID/vYSYGlwMzMkvhUSpvZOM/WIPN+8YDgQAFBlRGRjLhY/3Vpq/AtXtVAzzyfTOZYkwNqdXpwAq5+/51LphowUI5NEBYh8lhQeOJmPNA6EcF1h5L9cJTVLy3bkuCXcjoN2eEO1Nq0h/40G0R4pwIDAQAB"; var slideMePublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAogOQb0mMbuq4FQ4ZhWRhN8k76/gXOUE370VubZa9Up25GdptYXoRNniecUTDLyjfvWp7+YFW8iPqIp523qNXtQ0EynNhK4xNLvJCd1CjfAju6M0f+o8MOL1zV7g3dHqxICZoHwqBbQOWneDzG/DzJ22AVdLKwty0qbv8ESaCOCJe31ZnoYVMw5KNVkSuRrrhiGGh6xj7F3qZ0T5TOSp3fK7soDamQLevuU7Ndn5IQACjo92HNN0O2PR2cvEjkCRuIkNk2hnqinac984JCzCC0SC/JBnUZUAeYJ7Y8sjT+79z1T1g7yGgDesopnqORiBkeXEZHrFy7PifdA/ZX7rRwQIDAQAB"; var options = new Options(); options.checkInventoryTimeoutMs = Options.INVENTORY_CHECK_TIMEOUT_MS * 2; options.discoveryTimeoutMs = Options.DISCOVER_TIMEOUT_MS * 2; options.checkInventory = false; options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; options.prefferedStoreNames = new string[] { OpenIAB_Android.STORE_AMAZON }; options.availableStoreNames = new string[] { OpenIAB_Android.STORE_AMAZON }; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_GOOGLE, googlePublicKey } }; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_YANDEX, yandexPublicKey } }; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_SLIDEME, slideMePublicKey } }; options.storeSearchStrategy = SearchStrategy.INSTALLER_THEN_BEST_FIT; // Transmit options and start the service OpenIAB.init(options); } if (!_isInitialized) { return; } if (Button("Query Inventory")) { OpenIAB.queryInventory(new string[] { SKU }); } if (Button("Purchase Product")) { OpenIAB.purchaseProduct(SKU); } if (Button("Consume Product")) { if (_inventory != null && _inventory.HasPurchase(SKU)) { OpenIAB.consumeProduct(_inventory.GetPurchase(SKU)); } } // Android specific buttons #if UNITY_ANDROID if (Button("Test Purchase")) { OpenIAB.purchaseProduct("android.test.purchased"); } if (Button("Test Consume")) { if (_inventory != null && _inventory.HasPurchase("android.test.purchased")) { OpenIAB.consumeProduct(_inventory.GetPurchase("android.test.purchased")); } } if (Button("Test Item Unavailable")) { OpenIAB.purchaseProduct("android.test.item_unavailable"); } if (Button("Test Purchase Canceled")) { OpenIAB.purchaseProduct("android.test.canceled"); } #endif }
private void OnGUI() { _column = 0; _row = 0; GUI.skin.button.fontSize = (Screen.width >= SMALL_SCREEN_SIZE || Screen.height >= SMALL_SCREEN_SIZE) ? LARGE_FONT_SIZE : SMALL_FONT_SIZE; if (Button("Initialize OpenIAB")) { // Application public key var publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB"; var options = new Options(); options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_GOOGLE, publicKey } }; // Transmit options and start the service OpenIAB.init(options); } if (!_isInitialized) { return; } if (Button("Query Inventory")) { OpenIAB.queryInventory(new string[] { SKU }); } if (Button("Purchase Product")) { OpenIAB.purchaseProduct(SKU); } if (Button("Consume Product")) { OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU)); } // Android specific buttons #if UNITY_ANDROID if (Button("Test Purchase")) { OpenIAB.purchaseProduct("android.test.purchased"); } if (Button("Test Refund")) { OpenIAB.purchaseProduct("android.test.refunded"); } if (Button("Test Item Unavailable")) { OpenIAB.purchaseProduct("android.test.item_unavailable"); } if (Button("Test Purchase Canceled")) { OpenIAB.purchaseProduct("android.test.canceled"); } #endif }
private void BillingSupportedEvent() { WriteLog("billing supported, quering inventory..."); OpenIAB.queryInventory(); }
private void OnGUI() { float yPos = 5.0f; float xPos = 5.0f; float width = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160; float height = (Screen.width >= 800 || Screen.height >= 800) ? 80 : 40; float heightPlus = height + 10.0f; if (GUI.Button(new Rect(xPos, yPos, width, height), "Initialize OpenIAB")) { // Application public key var public_key = "key"; var options = new Options(); options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_GOOGLE, public_key } }; // Transmit options and start the service OpenIAB.init(options); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase")) { OpenIAB.purchaseProduct("android.test.purchased"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund")) { OpenIAB.purchaseProduct("android.test.refunded"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable")) { OpenIAB.purchaseProduct("android.test.item_unavailable"); } xPos = Screen.width - width - 5.0f; yPos = 5.0f; if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled")) { OpenIAB.purchaseProduct("android.test.canceled"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory")) { OpenIAB.queryInventory(); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product")) { OpenIAB.purchaseProduct(SKU); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Stop Billing Service")) { OpenIAB.unbindService(); } }
private void restoreSucceededEvent() { restoreSucceeded(); OpenIAB.queryInventory(); }
private void OnBillingSupported() { Debug.Log("Billing is supported"); OpenIAB.queryInventory(new string[] { SKU_EPIC_GEM, SKU_MEGA_GEM, SKU_XLARGE_GEM, SKU_LARGE_GEM, SKU_MED_GEM, SKU_SMALL_GEM }); }
private void OnGUI() { float yPos = 5.0f; float xPos = 5.0f; float width = (Screen.width >= 800 || Screen.height >= 800) ? 320 : 160; float height = (Screen.width >= 800 || Screen.height >= 800) ? 80 : 40; float heightPlus = height + 10.0f; if (GUI.Button(new Rect(xPos, yPos, width, height), "Initialize OpenIAB")) { // Application public key var public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqibEPHCtfPm3Rn26gbE6vhCc1d6A072im+oWNlkUAJYV//pt1vCkYLqkkw/P2esPSWaw1nt66650vfVYc3sYY6L782n/C+IvZWQt0EaLrqsSoNfN5VqPhPeGf3wqsOvbKw9YqZWyKL4ddZUzRUPex5xIzjHHm3qIJI5v7iFJHOxOj0bLuEG8lH0Ljt/w2bNe4o0XXoshYDqpzIKmKy6OYNQOs8iBTJlfSmPrlGudmldW6CsuAKeVGm+Z+2xx3Xxsx3eSwEgEaUc1ZsMWSGsV6dXgc3JrUvK23JRJUu8X5Ec1OQLyxL3VelD5f0iKVTJ1kw59tMAVZ7DDpzPggWpUkwIDAQAB"; var options = new Options(); options.verifyMode = OptionsVerifyMode.VERIFY_SKIP; options.storeKeys = new Dictionary <string, string> { { OpenIAB_Android.STORE_GOOGLE, public_key } }; // Transmit options and start the service OpenIAB.init(options); } if (!_isInitialized) { return; } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Purchase")) { OpenIAB.purchaseProduct("android.test.purchased"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Refund")) { OpenIAB.purchaseProduct("android.test.refunded"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Test Item Unavailable")) { OpenIAB.purchaseProduct("android.test.item_unavailable"); } xPos = Screen.width - width - 5.0f; yPos = 5.0f; if (GUI.Button(new Rect(xPos, yPos, width, height), "Test Purchase Canceled")) { OpenIAB.purchaseProduct("android.test.canceled"); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Query Inventory")) { OpenIAB.queryInventory(new string[] { SKU }); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Purchase Real Product")) { OpenIAB.purchaseProduct(SKU); } if (GUI.Button(new Rect(xPos, yPos += heightPlus, width, height), "Consume Real Product")) { OpenIAB.consumeProduct(Purchase.CreateFromSku(SKU)); } }
void queryInventory() { OpenIAB.queryInventory(); }
private void OnBillingSupported() { Debug.Log("Billing is supported"); OpenIAB.queryInventory(new string[] { SKU_AMMO, SKU_COWBOY_HAT, SKU_INFINITE_AMMO, SKU_MEDKIT }); }