public async Task <SKProductsResponse> RequestProductData(params string[] productIds)
        {
            var array = new NSString[productIds.Length];

            for (var i = 0; i < productIds.Length; i++)
            {
                array[i] = new NSString(productIds[i]);
            }

            var tcs = new TaskCompletionSource <SKProductsResponse>();

            _productDataRequests.AddLast(tcs);

            try
            {
                var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
                var productsRequest    = new SKProductsRequest(productIdentifiers);
                productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
                productsRequest.RequestFailed    += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
                productsRequest.Start();
                var ret = await tcs.Task;
                productsRequest.Dispose();
                return(ret);
            }
            finally
            {
                _productDataRequests.Remove(tcs);
                Console.WriteLine("Remaining: " + _productDataRequests.Count);
            }
        }
        public async Task<SKProductsResponse> RequestProductData (params string[] productIds)
        {
            var array = new NSString[productIds.Length];
            for (var i = 0; i < productIds.Length; i++)
                array[i] = new NSString(productIds[i]);

            var tcs = new TaskCompletionSource<SKProductsResponse>();
            _productDataRequests.AddLast(tcs);

            try
            {
                var productIdentifiers = NSSet.MakeNSObjectSet<NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
                var productsRequest = new SKProductsRequest(productIdentifiers);
                productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
                productsRequest.RequestFailed += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
                productsRequest.Start();
                if (await Task.WhenAny(tcs.Task, Task.Delay(TimeSpan.FromSeconds(30))) != tcs.Task)
                    throw new InvalidOperationException("Timeout waiting for Apple to respond");
                var ret = tcs.Task.Result;
                productsRequest.Dispose();
                return ret;
            }
            finally
            {
                _productDataRequests.Remove(tcs);
            }
        }
        public async Task <SKProductsResponse> RequestProductData(params string[] productIds)
        {
            var array = new NSString[productIds.Length];

            for (var i = 0; i < productIds.Length; i++)
            {
                array[i] = new NSString(productIds[i]);
            }

            var tcs = new TaskCompletionSource <SKProductsResponse>();

            _productDataRequests.AddLast(tcs);

            try
            {
                var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
                var productsRequest    = new SKProductsRequest(productIdentifiers);
                productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
                productsRequest.RequestFailed    += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
                productsRequest.Start();
                if (await Task.WhenAny(tcs.Task, Task.Delay(TimeSpan.FromSeconds(30))) != tcs.Task)
                {
                    throw new InvalidOperationException("Timeout waiting for Apple to respond");
                }
                var ret = tcs.Task.Result;
                productsRequest.Dispose();
                return(ret);
            }
            finally
            {
                _productDataRequests.Remove(tcs);
            }
        }
        public async Task<SKProductsResponse> RequestProductData (params string[] productIds)
        {
            var array = new NSString[productIds.Length];
            for (var i = 0; i < productIds.Length; i++)
                array[i] = new NSString(productIds[i]);

            var tcs = new TaskCompletionSource<SKProductsResponse>();
            _productDataRequests.AddLast(tcs);

            try
            {
                var productIdentifiers = NSSet.MakeNSObjectSet<NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
                var productsRequest = new SKProductsRequest(productIdentifiers);
                productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
                productsRequest.RequestFailed += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
                productsRequest.Start();
                var ret = await tcs.Task;
                productsRequest.Dispose();
                return ret;
            }
            finally
            {
                _productDataRequests.Remove(tcs);
                Console.WriteLine("Remaining: " + _productDataRequests.Count);
            }
        }
Exemple #5
0
    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();
    }
Exemple #6
0
        public void requestProUpgradeProductData()
        {
            NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString>(new NSString[] { new NSString(InAppPurchaseProUpgradeProductId) });

            productsRequest          = new SKProductsRequest(productIdentifiers);
            productsRequest.Delegate = this;
            productsRequest.Start();
        }
		public Task<SKProductsResponse> FetchProductInformationAsync (string[] ids)
		{
			var request = new SKProductsRequest (
				NSSet.MakeNSObjectSet (ids.Select (x => new NSString(x)).ToArray ()));
			var del = new TaskRequestDelegate ();
			request.Delegate = del;
			request.Start ();
			return del.Task;
		}
        public Task <SKProductsResponse> FetchProductInformationAsync(string[] ids)
        {
            var request = new SKProductsRequest(
                NSSet.MakeNSObjectSet(ids.Select(x => new NSString(x)).ToArray()));
            var del = new TaskRequestDelegate();

            request.Delegate = del;
            request.Start();
            return(del.Task);
        }
		// request multiple products at once
		public void RequestProductData (List<string> productIds)
		{
			NSString[] array = productIds.Select (pId => (NSString)pId).ToArray();
			NSSet productIdentifiers = NSSet.MakeNSObjectSet<NSString>(array);

			//set up product request for in-app purchase
			ProductsRequest  = new SKProductsRequest(productIdentifiers);
			ProductsRequest.Delegate = this; // SKProductsRequestDelegate.ReceivedResponse
			ProductsRequest.Start();
		}
Exemple #10
0
        // request multiple products at once
        public void RequestProductData(List <string> productIds)
        {
            NSString[] array = productIds.Select(pId => (NSString)pId).ToArray();
            NSSet      productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array);

            //set up product request for in-app purchase
            ProductsRequest          = new SKProductsRequest(productIdentifiers);
            ProductsRequest.Delegate = this;             // SKProductsRequestDelegate.ReceivedResponse
            ProductsRequest.Start();
        }
 public async override Task <Purchase[]> GetPrices(params string[] ids)
 {
     using (var del = new RequestDelegate())
         using (var request = new SKProductsRequest(new NSSet(ids))
         {
             Delegate = del,
         })
         {
             request.Start();
             return(await del.Source.Task);
         }
 }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            /*var vc = new MapKitViewController (this) {
             *      Autorotate = dvc.Autorotate
             * };*/

            NetworkActivity = true;
            if (SKPaymentQueue.CanMakePayments)
            {
                // Let's do it
                NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString>(/*new NSString[]{new NSString("com.savagesoftwaresolutions.murdermap.subscription.monthly"), new NSString("com.savagesoftwaresolutions.com.murdermap.monthly")}*/ ProductIdentifiers);
                var   request            = new SKProductsRequest(productIdentifiers);

                request.ReceivedResponse += delegate(object sender, SKProductsRequestResponseEventArgs e)
                {
                    var root         = new RootElement(Caption);
                    var dvStore      = new DialogViewController(root, true);
                    var storeSection = new Section();

                    root.Add(storeSection);


                    foreach (var product in e.Response.Products)
                    {
                        storeSection.Add(new StringElement(product.LocalizedTitle + ":" + product.PriceLocale));
                    }

                    dvc.ActivateController(dvStore);
                };

                request.RequestFailed += delegate(object sender, SKRequestErrorEventArgs e)
                {
                    using (var msg = new UIAlertView("Request Failed", e.Error.ToString(), null, "Ok")){
                        msg.Show();
                    }
                };

                request.RequestFinished += delegate(object sender, EventArgs e) {
                    NetworkActivity = false;
                };

                request.Start();
            }
            else
            {
                using (var msg = new UIAlertView("Unabled to Make Payments", "We are unable to connect to the Apple Store at this moment, to process your payments.\n Please try again later.", null, "Ok")){
                    msg.Show();
                }
            }

            NetworkActivity = false;
        }
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			/*var vc = new MapKitViewController (this) {
				Autorotate = dvc.Autorotate
			};*/
			
			NetworkActivity = true;
			if ( SKPaymentQueue.CanMakePayments )
			{
				// Let's do it
				NSSet productIdentifiers  = NSSet.MakeNSObjectSet<NSString>(/*new NSString[]{new NSString("com.savagesoftwaresolutions.murdermap.subscription.monthly"), new NSString("com.savagesoftwaresolutions.com.murdermap.monthly")}*/ ProductIdentifiers);
				var request = new SKProductsRequest(productIdentifiers);
				
				request.ReceivedResponse += delegate(object sender, SKProductsRequestResponseEventArgs e) 
				{
					var root = new RootElement (Caption);
					var dvStore = new DialogViewController (root, true);
					var storeSection = new Section();
					
					root.Add(storeSection);
			
					
					foreach (var product in e.Response.Products) 
					{
						storeSection.Add(new StringElement(product.LocalizedTitle +":"+ product.PriceLocale ) );
					}
					
					dvc.ActivateController (dvStore);
				};
				
				request.RequestFailed += delegate(object sender, SKRequestErrorEventArgs e) 
				{					
					using (var msg = new UIAlertView ("Request Failed", e.Error.ToString(), null, "Ok")){
						msg.Show ();
					}
				};
				
				request.RequestFinished += delegate(object sender, EventArgs e) {
					NetworkActivity = false;
				};				
				
				request.Start();
			}
			else
			{
				using (var msg = new UIAlertView ("Unabled to Make Payments", "We are unable to connect to the Apple Store at this moment, to process your payments.\n Please try again later.", null, "Ok")){
					msg.Show ();
				}
			}
			
			NetworkActivity = false;
		}
		// request multiple products at once
		public void RequestProductData (List<string> productIds)
		{
			var array = new NSString[productIds.Count];
			for (var i = 0; i < productIds.Count; i++) {
				array[i] = new NSString(productIds[i]);
			}
		 	NSSet productIdentifiers = NSSet.MakeNSObjectSet<NSString>(array);			

			//set up product request for in-app purchase
			productsRequest  = new SKProductsRequest(productIdentifiers);
			productsRequest.Delegate = this; // SKProductsRequestDelegate.ReceivedResponse
			productsRequest.Start();
		}
Exemple #15
0
        public void RequestProductData(List <string> productIds)
        {
            var array = new NSString[productIds.Count];

            for (var i = 0; i < productIds.Count; i++)
            {
                array[i] = new NSString(productIds[i]);
            }
            NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString> (array);

            productsRequest          = new SKProductsRequest(productIdentifiers);
            productsRequest.Delegate = this;
            productsRequest.Start();
        }
Exemple #16
0
        Task <SKProduct> GetProductAsync(string productId)
        {
            var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(new NSString[] { new NSString(productId) });

            var productRequestDelegate = new ProductRequestDelegate();

            //set up product request for in-app purchase
            var productsRequest = new SKProductsRequest(productIdentifiers);

            productsRequest.Delegate = productRequestDelegate; // SKProductsRequestDelegate.ReceivedResponse
            productsRequest.Start();

            return(productRequestDelegate.WaitForResponse());
        }
Exemple #17
0
        public static async Task<SKProductsResponse> RequestProductData (params string[] productIds)
        {
            var array = new NSString[productIds.Length];
            for (var i = 0; i < productIds.Length; i++)
                array[i] = new NSString(productIds[i]);

            var tcs = new TaskCompletionSource<SKProductsResponse>();
            var productIdentifiers = NSSet.MakeNSObjectSet<NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
            var productsRequest = new SKProductsRequest(productIdentifiers);
            productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
            productsRequest.RequestFailed += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
            productsRequest.Start();
            return await tcs.Task;
        }
        Task <IEnumerable <SKProduct> > GetProductAsync(string[] productId)
        {
            var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(productId.Select(i => new NSString(i)).ToArray());

            var productRequestDelegate = new ProductRequestDelegate();

            //set up product request for in-app purchase
            var productsRequest = new SKProductsRequest(productIdentifiers);

            productsRequest.Delegate = productRequestDelegate; // SKProductsRequestDelegate.ReceivedResponse
            productsRequest.Start();

            return(productRequestDelegate.WaitForResponse());
        }
Exemple #19
0
        // request multiple products at once
        public void RequestProductData(List <string> productIds)
        {
            var array = new NSString[productIds.Count];

            for (var i = 0; i < productIds.Count; i++)
            {
                array[i] = new NSString(productIds[i]);
            }
            NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array);

            //set up product request for in-app purchase
            productsRequest          = new SKProductsRequest(productIdentifiers);
            productsRequest.Delegate = this;             // SKProductsRequestDelegate.ReceivedResponse
            productsRequest.Start();
        }
Exemple #20
0
        public void RequestProductData(List <string> productIds, ProductResponseDelegate responseDelegate)
        {
            NSMutableSet setIds = new NSMutableSet();

            foreach (string s in productIds)
            {
                setIds.Add(new NSString(s));
            }

            this.responseDelegate = responseDelegate;

            productsRequest          = new SKProductsRequest(setIds);
            productsRequest.Delegate = this;
            productsRequest.Start();
        }
        /// <summary>
        /// Returns product info for the specified Ids
        /// </summary>
        /// <param name="productIds">Product Ids</param>
        /// <param name="productType">Product Type - not used for iOS</param>
        /// <returns></returns>
        public async Task <IEnumerable <Product> > LoadProductsAsync(string[] productIds, ProductType productType)
        {
            NSString[] nsProductIds = productIds.Select(i => new NSString(i)).ToArray();
            // Try to get Product List from the Store
            NSSet nsSetOfproductIds = NSSet.MakeNSObjectSet <NSString>(nsProductIds);

            // Create a Delegeate which will receieve product data.
            // The callback is async, so the TaskCompletionSource is used to wait for App Store to respond.
            ProductRequestDelegate productRequestDelegate = new ProductRequestDelegate();

            // Set up product request for in-app purchase
            SKProductsRequest productsRequest = new SKProductsRequest(nsSetOfproductIds);

            productsRequest.Delegate = productRequestDelegate;

            /* Here is how the EventHadler could be used instead of the Delegate
             * productsRequest.ReceivedResponse += (object sender, SKProductsRequestResponseEventArgs e) =>
             * {
             *  var products = e.Response.Products;
             *  var product = products[0];
             *  Console.WriteLine(
             *      $"{product.ProductIdentifier}, " +
             *      $"{product.LocalizedDescription}," +
             *      $"{product.PriceLocale.CurrencySymbol}{product.Price}");
             *
             *  //product.Discounts
             * };*/

            // Start the StoreKit Request. Products will be sent back to the Delegate function(s)
            productsRequest.Start();

            // Wait for the Delegate to get Products and signal the Task to be complete
            // For more about TaskCompletionSource read: https://devblogs.microsoft.com/pfxteam/the-nature-of-taskcompletionsourcetresult/
            SKProduct[] products = await productRequestDelegate.WaitForResponse();

            return(products.Select(p => new Product
            {
                FormattedPrice = p.LocalizedPrice(),
                MicrosPrice = (long)(p.Price.DoubleValue * 1000000d),
                Name = p.LocalizedTitle,
                ProductId = p.ProductIdentifier,
                Description = p.LocalizedDescription,
                CurrencyCode = p.PriceLocale?.CurrencyCode ?? string.Empty,
                LocalizedIntroductoryPrice = IsiOS112 ? (p.IntroductoryPrice?.LocalizedPrice() ?? string.Empty) : string.Empty,
                MicrosIntroductoryPrice = IsiOS112 ? (long)((p.IntroductoryPrice?.Price?.DoubleValue ?? 0) * 1000000d) : 0,
            }));
        }
Exemple #22
0
        /// <summary>
        /// Initializes IAPXT with an array of product IDs.
        /// </summary>
        /// <remarks>Raises InitializationCompleted event when completed, or InitializationFailed event when failed.</remarks>
        /// <param name="productIDs">Product IDs.</param>
        public static void Init(string[] productIDs)
        {
            // init observer here so the observer is observing only if the user wants to use the high-level API
            // add observer only once
            if (!_initd)
            {
                SKPaymentQueue.DefaultQueue().AddTransactionObserver(PaymentTransactionObserver.instance);
                _initd = true;
            }

            _initializingProductIDs = productIDs;
            _request = new SKProductsRequest(productIDs);
//			_request.Delegate = ProductsRequestDelegate.instance;
            _request.DidReceive += _OnProductRequestReceive;
            _request.DidFail    += _OnProductRequestFail;
            _request.Start();
        }
Exemple #23
0
        public static async Task <SKProductsResponse> RequestProductData(params string[] productIds)
        {
            var array = new NSString[productIds.Length];

            for (var i = 0; i < productIds.Length; i++)
            {
                array[i] = new NSString(productIds[i]);
            }

            var tcs = new TaskCompletionSource <SKProductsResponse>();
            var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array); //NSSet.MakeNSObjectSet<NSString>(array);​​​
            var productsRequest    = new SKProductsRequest(productIdentifiers);

            productsRequest.ReceivedResponse += (sender, e) => tcs.SetResult(e.Response);
            productsRequest.RequestFailed    += (sender, e) => tcs.SetException(new Exception(e.Error.LocalizedDescription));
            productsRequest.Start();
            return(await tcs.Task);
        }
Exemple #24
0
    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();
    }
		// request multiple products at once
		public void RequestProductData (List<string> productIds)
		{
			NetworkStatus internetStatus = Reachability.InternetConnectionStatus ();
			if (internetStatus == NetworkStatus.NotReachable) {

				NSNotificationCenter.DefaultCenter.PostNotificationName (NoInternetNotification, null);
				Console.WriteLine ("No Internet");
			} else {
				var array = new NSString[productIds.Count];
				for (var i = 0; i < productIds.Count; i++) {
					array [i] = new NSString (productIds [i]);
				}
				NSSet productIdentifiers = NSSet.MakeNSObjectSet<NSString> (array);			

				//set up product request for in-app purchase

				productsRequest = new SKProductsRequest (productIdentifiers);
				productsRequest.Delegate = this; // SKProductsRequestDelegate.ReceivedResponse
				productsRequest.Start ();
			}
		}
            public async Task <SKProductsResponse> GetProductData(params string[] appStoreProductIDs)
            {
                _response = null;
                _error    = null;
                _waiter.Reset();


                if (appStoreProductIDs.Length == 0)
                {
                    throw new ArgumentException("No app store product IDs passed", "appStoreProductIDs");
                }
                var array = new NSString[appStoreProductIDs.Length];

                for (var i = 0; i < appStoreProductIDs.Length; i++)
                {
                    array[i] = new NSString(appStoreProductIDs[i]);
                }
                var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array);

                //set up product request for in-app purchase
                var productsRequest = new SKProductsRequest(productIdentifiers);

                productsRequest.Delegate = this;
                productsRequest.Start();
                await Task.Run(() => _waiter.Wait());


                if (_response != null)
                {
                    return(_response);
                }

                if (_error != null)
                {
                    throw new Exception(_error.LocalizedDescription);
                }

                throw new Exception("Unable to get product data due to unexpected cancellation of request");
            }
Exemple #27
0
        // request multiple products at once
        public void RequestProductData(List <string> productIds)
        {
            try
            {
                Logger.Log("RequestProductData...");
                var array = new NSString[productIds.Count];
                for (var i = 0; i < productIds.Count; i++)
                {
                    array[i] = new NSString(productIds[i]);
                    Logger.Log("RequestProductData: Product ID: " + productIds[i]);
                }

                NSSet productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array);

                //set up product request for in-app purchase
                productsRequest          = new SKProductsRequest(productIdentifiers);
                productsRequest.Delegate = this;
                productsRequest.Start();
            }
            catch (Exception ex)
            {
                Logger.Log("ERROR: RequestProductData: " + ex);
            }
        }
Exemple #28
0
        public async Task <SKProductsResponse> GetProductData(params string[] appStoreProductIDs)
        {
            if (appStoreProductIDs.Length == 0)
            {
                throw new ArgumentException("No app store product IDs passed", "appStoreProductIDs");
            }
            var array = new NSString[appStoreProductIDs.Length];

            for (var i = 0; i < appStoreProductIDs.Length; i++)
            {
                array[i] = new NSString(appStoreProductIDs[i]);
            }
            var productIdentifiers = NSSet.MakeNSObjectSet <NSString>(array);

            //set up product request for in-app purchase
            var productsRequest = new SKProductsRequest(productIdentifiers);

            productsRequest.Delegate = this;
            productsRequest.Start();
            await Task.Run(() => _waiter.Wait());

            Debug.Assert(_response != null);
            return(_response);
        }
        public override void RequestProductInformation(string[] productIds, ProductInformationDelegate onSucceed, RequestFailedDelegate onFailed)
        {
            if (productIds == null || productIds.Length == 0)
                throw new ArgumentException("InAppPurchaseManager: At least one product id is required.");

            try
            {
                var products = new NSString[productIds.Length];
                for (int i = 0; i < productIds.Length; i++)
                {
                    products[i] = new NSString(productIds[i]);
                }
                NSSet productIdentifiers = NSSet.MakeNSObjectSet<NSString>(products);

                if (productsRequestDelegate == null)
                {
                    productsRequestDelegate = new ProductsRequestDelegate(onSucceed, onFailed);
                }

                SKProductsRequest productsRequest = new SKProductsRequest(productIdentifiers);
                productsRequest.Delegate = productsRequestDelegate;
                productsRequest.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                if (onFailed != null)
                {
                    onFailed(new InAppPurchaseException("Error while requesting product information.", 0, ex));
                }
            }
        }
 public void requestProUpgradeProductData()
 {
     NSSet productIdentifiers  = NSSet.MakeNSObjectSet<NSString>(new NSString[]{new NSString(InAppPurchaseProUpgradeProductId)});
     productsRequest  = new SKProductsRequest(productIdentifiers);
     productsRequest.Delegate = this;
     productsRequest.Start();
 }
Exemple #31
0
        /// <summary>
        /// Initializes IAPXT with an array of product IDs.
        /// </summary>
        /// <remarks>Raises InitializationCompleted event when completed, or InitializationFailed event when failed.</remarks>
        /// <param name="productIDs">Product IDs.</param>
        public static void Init(string[] productIDs)
        {
            // init observer here so the observer is observing only if the user wants to use the high-level API
            // add observer only once
            if (!_initd) {
                SKPaymentQueue.DefaultQueue().AddTransactionObserver(PaymentTransactionObserver.instance);
                _initd = true;
            }

            _initializingProductIDs = productIDs;
            _request = new SKProductsRequest(productIDs);
            //			_request.Delegate = ProductsRequestDelegate.instance;
            _request.DidReceive += _OnProductRequestReceive;
            _request.DidFail += _OnProductRequestFail;
            _request.Start();
        }
 private void RequestProducts()
 {
     // List all the products to retrieve
     SKProductsRequest request = new SKProductsRequest(NSSet.SetWithObjects((NSString)"CONSUMABLE", (NSString)"NON_CONSUMABLE", null));
     request.Delegate = this;
     request.Start();
 }