/// <summary> /// Purchase a specific product or subscription /// </summary> /// <param name="productId">Sku or ID of product</param> /// <param name="itemType">Type of product being requested</param> /// <param name="payload">Developer specific payload</param> /// <param name="verifyPurchase">Verify purchase implementation</param> /// <returns></returns> /// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception> public async override Task <InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string payload, IInAppBillingVerifyPurchase verifyPurchase = null) { // Get purchase result from store or simulator var purchaseResult = await CurrentAppMock.RequestProductPurchaseAsync(InTestingMode, productId); // Transform it to InAppBillingPurchase return(purchaseResult.ReceiptXml.ToInAppBillingPurchase(purchaseResult.Status).FirstOrDefault()); }
/// <summary> /// Purchase a specific product or subscription /// </summary> /// <param name="productId">Sku or ID of product</param> /// <param name="itemType">Type of product being requested</param> /// <param name="obfuscatedAccountId">Specifies an optional obfuscated string that is uniquely associated with the user's account in your app.</param> /// <param name="obfuscatedProfileId">Specifies an optional obfuscated string that is uniquely associated with the user's profile in your app.</param> /// <returns></returns> /// <exception cref="InAppBillingPurchaseException">If an error occurs during processing</exception> public async override Task <InAppBillingPurchase> PurchaseAsync(string productId, ItemType itemType, string obfuscatedAccountId = null, string obfuscatedProfileId = null) { // Get purchase result from store or simulator var purchaseResult = await CurrentAppMock.RequestProductPurchaseAsync(InTestingMode, productId); if (purchaseResult == null) { return(null); } if (string.IsNullOrWhiteSpace(purchaseResult.ReceiptXml)) { return(null); } // Transform it to InAppBillingPurchase return(purchaseResult.ReceiptXml.ToInAppBillingPurchase(purchaseResult.Status).FirstOrDefault()); }