public void Start() { string productId = "woot"; var request = new SKProductsRequest(productId); request.ReceivedResponse += (sender, e) => { Assert.AreEqual(productId, e.Response.InvalidProducts[0]); Console.WriteLine("Received Response!"); }; request.Failed += (sender, e) => { Console.WriteLine("Failed: " + e.Error.LocalizedDescription); }; request.Finished += (sender, e) => { Console.WriteLine("Finished!"); }; request.Start(); }
public void GetIAPPrices() { if (Application.platform != RuntimePlatform.IPhonePlayer) { Debug.Log("Only supported on iOS!"); return; } //NOTE: for this to work, your app's bundle ID should match what you have setup in iTunes Connect // Each in-app purchase ID should be what you have setup in iTunes Connect also var request = new SKProductsRequest("com.yourcompany.iap1", "com.yourcompany.iap2"); request.Failed += (sender, e) => { Debug.Log("Error retrieviing prices: " + e.Error.LocalizedDescription); }; request.ReceivedResponse += (sender, e) => { //Invalid ones -- this will print out by default if (e.Response.InvalidProducts != null) { foreach (string invalidId in e.Response.InvalidProducts) { Debug.Log ("Invalid ID: " + invalidId); } } //Successful ones PrintProducts(e.Response.Products); }; request.Start(); }