public static async Task HandlePurchaseCompletionAsync(StoreKit.SKPaymentTransaction t) { var p = prices.FirstOrDefault(x => x.Id == t.Payment.ProductIdentifier); if (p == null) { return; } await AddSubscriptionAsync(t.TransactionIdentifier, (DateTime)t.TransactionDate, p); }
public static async Task HandlePurchaseFailAsync(StoreKit.SKPaymentTransaction t) { try { var m = t.Error != null ? t.Error.LocalizedDescription : "Unknown error"; var alert = UIAlertController.Create("Purchase Failed", m, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, a => {})); var vc = UIApplication.SharedApplication.KeyWindow.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; } vc.PresentViewController(alert, true, null); } catch (Exception ex) { Log.Error(ex); } }
public static async Task HandlePurchaseFailAsync(StoreKit.SKPaymentTransaction t) { try { var p = prices.FirstOrDefault(x => x.Id == t.Payment.ProductIdentifier); if (p == null) { return; } var m = t.Error != null ? t.Error.LocalizedDescription : "Unknown error"; var alert = UIAlertController.Create("Tip Failed", m, UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, a => { })); visibleForm?.PresentViewController(alert, true, null); } catch (Exception ex) { visibleForm?.ShowError(ex); Log.Error(ex); } }
private async void ProductPurchased(StoreKit.SKPaymentTransaction transaction, InAppProduct product) { // update list to remove any non-consumable products that were var result = await App.Locator.ReloadCredit.InsertPurchase(product.ProductIdentifier , string.Empty , string.Empty , PlateformeVersionEnum.IOS); if (result == 0) { using (var alert = new UIAlertView(Application.LocalizedString("BuyPack") , string.Format(Application.LocalizedString("BuySuccess") , product.Title) , null , Application.LocalizedString("OK") , null)) { alert.Show(); } } }