// Use this for initialization void Start() { Application.targetFrameRate = 60; QualitySettings.vSyncCount = 0; m_eStep = STEP.IDLE; m_eStep = STEP.DATAMANAGER_SETUP; m_eStepPre = STEP.MAX; //m_SwitchSpriteBack.SetSprite ("garalley_003"); m_SwitchSpriteBack.SetSprite("bg001"); //m_SwitchSpriteBack.SetSprite ("tutorial777"); SoundManager.Instance.PlayBGM("bgm_opening"); #if UNITY_ANDROID GoogleIAB.enableLogging(true); string key = "your public key from the Android developer portal here"; key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsqFXrg2t62dru/VFQYyxd2m1kORBbrAGxDxiSAkh3ybaXJtJWNcej/YAxKx7Orrtfq+pU965U2FnU3K54xddts2UGCI9O6TSU0AoKbwFYj+okfF21firsEqZd4aYtVYQ471flWj3ZEG9u2YpIzjGykUQadsxO4Y/OcRbdUn9289Mc0JAbdepmN9yRnvgBJWKZF/c0mBrM4ISfF5TVip2Tp+BXACqblOb+TQZjOB0OeVPxYpdy5k3eJTcQuwiLmYxgpEBL3tIT7grxVROgk8YYncncaZR7Q/wWlsFgFTNMRaF2bPI8apLiA7eIyKv5zbmhbE7YLBXUvkuoHbAqDQrLQIDAQAB"; Debug.Log(key); //下はテスト用 //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB"; GoogleIAB.init(key); #endif }
public override void Start() { base.Start(); Debug.Log("Android billing is starting."); SubscribeToEvents(); GoogleIAB.enableLogging(true); GoogleIAB.init(KEY); GoogleIAB.queryInventory(MarketLot.AllLots.Select(l => l.ProductAndroidIdentifier).ToArray()); }
private void initialize() { DontDestroyOnLoad(gameObject); #if UNITY_ANDROID GoogleIAB.enableLogging(true); GoogleIAB.init("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB"); #endif }
public void initialize() { if (!IsInitialized) { DontDestroyOnLoad(gameObject); m_bPurchased = false; #if UNITY_IPHONE //You do not have to add products by code if you already did it in seetings guid //Windows -> IOS Native -> Edit Settings //Billing tab. IOSInAppPurchaseManager.Instance.AddProductId(TICKET_010); IOSInAppPurchaseManager.Instance.AddProductId(TICKET_055); IOSInAppPurchaseManager.Instance.AddProductId(TICKET_125); IOSInAppPurchaseManager.Instance.AddProductId(TICKET_350); IOSInAppPurchaseManager.Instance.AddProductId(TICKET_800); IOSInAppPurchaseManager.OnVerificationComplete += HandleOnVerificationComplete; IOSInAppPurchaseManager.OnStoreKitInitComplete += OnStoreKitInitComplete; IOSInAppPurchaseManager.OnTransactionComplete += OnTransactionComplete; IOSInAppPurchaseManager.OnRestoreComplete += OnRestoreComplete; IOSInAppPurchaseManager.instance.LoadStore(); #elif UNITY_ANDROID 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; GoogleIAB.enableLogging(true); string key = "your public key from the Android developer portal here"; // jp.app.bokunozoo key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsqFXrg2t62dru/VFQYyxd2m1kORBbrAGxDxiSAkh3ybaXJtJWNcej/YAxKx7Orrtfq+pU965U2FnU3K54xddts2UGCI9O6TSU0AoKbwFYj+okfF21firsEqZd4aYtVYQ471flWj3ZEG9u2YpIzjGykUQadsxO4Y/OcRbdUn9289Mc0JAbdepmN9yRnvgBJWKZF/c0mBrM4ISfF5TVip2Tp+BXACqblOb+TQZjOB0OeVPxYpdy5k3eJTcQuwiLmYxgpEBL3tIT7grxVROgk8YYncncaZR7Q/wWlsFgFTNMRaF2bPI8apLiA7eIyKv5zbmhbE7YLBXUvkuoHbAqDQrLQIDAQAB"; // jp.app.bokuno.zoo key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3xplcFnhYvPYqsxu5D2hP/DwOYHTOUgy59ZUhLaUyEKyK9HZ5hpeDFFe2WqopiR2tM5aD6zRs1WFJqLKjoqoeMi4BwbtAcGOK1I5BDAe9YmDlGN+YEkG6nBPwEm+IZ1C9pLkAi9EoCc28xS/pUlwIPP8/PSMjTpTixO5S0lbKk5tY3VJyt454khCE/XFJMZd6C0j2sBiLwxi7vpZ3i5X0bl75sMr3fvIFdS7WT+m9slwsEZ9qDw/H0Uh01yA5gJn8CkNQ0x04gw+OrtepalTDvE4Lb/nzs6+1QwAi7jbvzPwCD9KDyhfEfLjjj/iOI9nkfjDMXt9d6+n6TCKROfsUwIDAQAB"; Debug.Log(key); //下はテスト用 //key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArGLKSb92Imt43S40ArCXfTmQ31c+pFQTM0Dza3j/Tn4cqjwccjQ/jej68GgVyGXGC2gT/EtbcVVA+bHugXmyv73lGBgmQlzBL41WYTKolO8Z6pVWTeHBtsT7RcHKukoKiONZ7NiQ9P5t6CCPBB2sXQOp1y3ryVbv01xXlM+hB6HkkKxrT6lIjTbtiVXCHAJvqPexPbqVIfGjBaXH/oHKxEBxYDaa6PTUsU3OP3MTx63ycTEnEMsQlA1W6ZuTFIa5Jd3cVlfQI7uovEzAbIlUfwcnxVOUWASiYe81eQiD1BMl+JeCRhfd5e8D4n0LOA12rHm1F3fC9ZoIEjpNB+BRhwIDAQAB"; GoogleIAB.init(key); #endif } IsInitialized = true; }
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"); }
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(); }
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(); }
void OnGUI() { beginColumn(); if (GUILayout.Button("Initialize IAB")) { var key = "your public key from the Android developer portal here"; key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6jn+Es/Lp/MaC6HsFY1XDVd7ZRU19b7NnOmjKN4Zs/kgb1/A8g0tlrgs85/yfzmroPIp66SnTsvtuV1bbbNcIwaecswCTHNOAksokZtLlOc7B/90cp1EdNM1ERKxmcLy3nsaCvWkTDSP/+MD0jdI1KLwCTnjsbcNAUy+zSlIu0xmw+lGSoB/0l4xiniF701yLjWct0OMNljOoSOVRiq5/mhXrt8UWHpB/F4JNJB3CbqODALPII5fcg7KNXo7P0Zov+ndAF2UjzSCru1H97bWoQYScdrtCgnrBGuNtInbSw5qUZFaPDouKaRHOgbSU+4a4+7ZcvjEmXpY9AlNAEZrQIDAQAB"; 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("ruby_50", "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(); }
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"; key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6CkjzMnNCuwRhqpOelNnvdJkQ6xr3E2I++ubNNOk4GeBx99Fh0wZJZQ6mHB+2b4sD55+rHU2OUavNtM7b8Cu7En4Hkeac1bi4LWf9DiL7OTHz3o6atH9T0gZPewtZb+rkYuXP1GURs+Vt/aKOnAhgOjUsU++KW3rvevnvUMF5hDl3O1XsybepEldJ4aSPvful5NJiIVf3qkiP1jTGcdFTnjznOeGaI9bRmTOrnZIrSsfo5FKcX9hROrolGOy01Oa706yi6xHd6Et0TKtPPbiF8KNB4JUGku/4Uwc37o1osNDVjEp55tyLXP9W4QgXtNNE7tBswvRvGgcMTIcCKUemwIDAQAB"; 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" }; var skus = new string[] { "xsmall", "small", "medium", "big", "extrabig" }; 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(); }
void OnGUI() { beginColumn(); if (GUILayout.Button("Initialize IAB")) { var key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApi6+DL/itNA4Qqog3d/wTk4tAxwxQRBF0VbmGv2ry2dhevo7Vi/z8gWTmr6aeQs3R24xCBOyYArceqymT0RKsFsmz7bh6IUc2rO6MftX1QGQdWXSyxYqZo4gOOeMeTYWmpNWubA2riL5hsx1R8mYgSemGW85WCEpRynI5T1yR3ioWoI8Fz3gNyQdcFiwYLn44t9tRX2fMNT3gdxLU4qMlVd+71ArZRyZI/zaYIIFCkRUvDpitYd3aPMzA7LZMGm96zCPd+zpNRptjjU5kG6ezA7JGKx4JJ3/CHKvyKzJrEo5loQLot5bBc+Rw/omyOQgd306P3g72qubFHlFLzFKbwIDAQAB"; 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[] { "android.test.purchased", "cp1" }; GoogleIAB.queryInventory(skus); } if (GUILayout.Button("Are subscriptions supported?")) { Debug.Log("subscriptions supported: " + GoogleIAB.areSubscriptionsSupported()); } if (GUILayout.Button("Purchase Test Product")) { GoogleIAB.purchaseProduct("cp1"); } if (GUILayout.Button("Consume Test Purchase")) { GoogleIAB.consumeProduct("cp1"); } 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(); }
void OnGUI() { beginColumn(); if (GUILayout.Button("Initialize IAB")) { var key = "your public key from the Android developer portal here"; 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(); }
// initialize IAPs, billing systems and database, // as well as shop components in this order void Awake() { //make sure we keep one instance of this script in the game if (instance) { Destroy(gameObject); return; } DontDestroyOnLoad(this); //ensure that we are always developing on a mobile platform, //otherwise print a warning #if !UNITY_ANDROID && !UNITY_IPHONE Debug.LogWarning("IAPManager: Detected non-mobile platform. Purchases for real money are" + " not supported on this platform. Please switch to iOS/Android."); #endif //set static reference instance = this; //populate IAP dictionary and arrays with product ids InitIds(); //map Prime31 IAP handler delegates to fire corresponding methods #if UNITY_ANDROID GoogleIABManager.billingSupportedEvent += RequestProductData; GoogleIABManager.billingNotSupportedEvent += BillingNotSupported; GoogleIABManager.queryInventorySucceededEvent += ProductDataReceived; GoogleIABManager.queryInventoryFailedEvent += BillingNotSupported; GoogleIABManager.purchaseSucceededEvent += PurchaseSucceeded; GoogleIABManager.purchaseFailedEvent += PurchaseFailed; GoogleIABManager.consumePurchaseSucceededEvent += ConsumeSucceeded; GoogleIABManager.consumePurchaseFailedEvent += PurchaseFailed; //initializes Google's billing system //by passing in your google dev key if (!string.IsNullOrEmpty(googleStoreKey)) { GoogleIAB.init(googleStoreKey); } else { Debug.LogWarning("IAPManager: Google Store Key missing on IAP Manager prefab. " + "Purchases for real money won't be supported on the device."); } //enables high detail logging to the console, //do not comment out in production versions! //this is for testing only GoogleIAB.enableLogging(false); #elif UNITY_IPHONE StoreKitManager.productListReceivedEvent += ProductDataReceived; StoreKitManager.productListRequestFailedEvent += BillingNotSupported; StoreKitManager.purchaseSuccessfulEvent += PurchaseSucceeded; StoreKitManager.purchaseFailedEvent += PurchaseFailed; StoreKitManager.purchaseCancelledEvent += PurchaseFailed; StoreKitManager.restoreTransactionsFinishedEvent += RestoreSucceeded; StoreKitManager.restoreTransactionsFailedEvent += RestoreFailed; //initializes Apple's billing system //when parental controls aren't active if (StoreKitBinding.canMakePayments()) { RequestProductData(); } else { BillingNotSupported("Apple App Store not available."); } #endif //initialize database, remote and shop managers GetComponent <DBManager>().Init(); StartCoroutine(RemoteDownload()); OnLevelWasLoaded(-1); }