public static void RequestProductPurchase(string productId, Action <InAppProductPurchaseResult> callback) { if (callback == null) { return; } Execute.ExecuteOnUIThread(async delegate { InAppProductPurchaseResult inAppProductPurchaseResult = new InAppProductPurchaseResult { Status = InAppProductPurchaseStatus.Cancelled }; try { productId = InAppPurchaseService.ToInAppProductId(productId); PurchaseResults purchaseResults = await CurrentApp.RequestProductPurchaseAsync(productId); if (purchaseResults != null) { inAppProductPurchaseResult.ReceiptXml = purchaseResults.ReceiptXml; inAppProductPurchaseResult.TransactionId = purchaseResults.TransactionId; if (!string.IsNullOrEmpty(purchaseResults.ReceiptXml)) { inAppProductPurchaseResult.Status = InAppProductPurchaseStatus.Purchased; } } } catch { inAppProductPurchaseResult.Status = InAppProductPurchaseStatus.Error; } callback.Invoke(inAppProductPurchaseResult); }); }
public static async void LoadProductReceipt(string productId, Action <string> callback) { if (callback != null) { string text = ""; try { productId = InAppPurchaseService.ToInAppProductId(productId); string text2 = await CurrentApp.GetProductReceiptAsync(productId); text = text2; } catch { } callback.Invoke(text); } }
public static void ReportConsumableProductFulfillment(InAppUnfulfilledProduct product, Action callback = null) { if (product == null) { return; } Execute.ExecuteOnUIThread(async delegate { try { await CurrentApp.ReportConsumableFulfillmentAsync(InAppPurchaseService.ToInAppProductId(product.ProductId), product.TransactionId); } catch { } Action expr_A2 = callback; if (expr_A2 != null) { expr_A2.Invoke(); } }); }