private void DemoNativeFlowWithProduct(Product product) { if (checkoutCreationTask != null && checkoutCreationTask.State == NSUrlSessionTaskState.Running) { checkoutCreationTask.Cancel(); } var cart = new Cart(); cart.AddVariant(product.Variants [0]); var checkout = new Checkout(cart); // Apply billing and shipping address, as well as email to the checkout checkout.ShippingAddress = Address; checkout.BillingAddress = Address; checkout.Email = "*****@*****.**"; client.UrlScheme = "xamarinsample://"; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; checkoutCreationTask = client.CreateCheckout(checkout, (chkout, error) => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (error == null && chkout != null) { var shippingController = new ShippingRatesTableViewController(client, chkout); NavigationController.PushViewController(shippingController, true); } else { Console.WriteLine("Error creating checkout: {0}", error); } }); }
private async Task DemoNativeFlowWithProductAsync(Product product) { var cart = new Cart(); cart.AddVariant(product.Variants[0]); var checkout = new Checkout(cart); // Apply billing and shipping address, as well as email to the checkout checkout.ShippingAddress = Address; checkout.BillingAddress = Address; checkout.Email = "*****@*****.**"; client.UrlScheme = "xamarinsample://"; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; try { checkout = await client.CreateCheckoutAsync(checkout); var shippingController = new ShippingRatesTableViewController(client, checkout); NavigationController.PushViewController(shippingController, true); } catch (NSErrorException ex) { Console.WriteLine("Error creating checkout: {0}", ex.Error); } UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }
private void DemoNativeFlowWithProduct(BUYProduct product) { if (checkoutCreationTask != null && checkoutCreationTask.State == NSUrlSessionTaskState.Running) { checkoutCreationTask.Cancel (); } var cart = new BUYCart (); cart.AddVariant (product.Variants [0]); var checkout = new BUYCheckout (cart); // Apply billing and shipping address, as well as email to the checkout checkout.ShippingAddress = Address; checkout.BillingAddress = Address; checkout.Email = "*****@*****.**"; client.UrlScheme = "xamarinsample://"; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; checkoutCreationTask = client.CreateCheckout (checkout, (chkout, error) => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; if (error == null && chkout != null) { var shippingController = new ShippingRatesTableViewController (client, chkout); NavigationController.PushViewController (shippingController, true); } else { Console.WriteLine ("Error creating checkout: {0}", error); } }); }