/// <summary> /// Tries to fulfill a Gold IAP with the given amount. /// </summary> /// <param name="productLicense">The store product license.</param> private async Task TryFulfillGold(ProductLicense productLicense) { if (productLicense.IsConsumable && productLicense.IsActive) { var receipt = await CurrentAppProxy.RequestProductPurchaseAsync(productLicense.ProductId); // Fulfill on PhotoSharingApp servers var user = await _photoService.FulfillGold(receipt.ReceiptXml); // If previous step was successful, fulfill in Store await CurrentAppProxy.ReportConsumableFulfillmentAsync(productLicense.ProductId, receipt.TransactionId); // Now update local gold balance AppEnvironment.Instance.CurrentUser.GoldBalance = user.GoldBalance; _telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldSuccess); } else { _telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldFail, new Dictionary <string, string> { { TelemetryProperties.ProductId, productLicense.ProductId } }); } }
/// <summary> /// Tries to fulfill a Gold IAP with the given amount. /// </summary> /// <param name="productLicense">The store product license.</param> private async Task TryFulfillGold(ProductLicense productLicense) { if (productLicense.IsConsumable && productLicense.IsActive) { var receipt = await CurrentAppProxy.RequestProductPurchaseAsync(productLicense.ProductId); // Fulfill on PhotoSharingApp servers var user = await _photoService.FulfillGold(receipt.ReceiptXml); // If previous step was successful, fulfill in Store await CurrentAppProxy.ReportConsumableFulfillmentAsync(productLicense.ProductId, receipt.TransactionId); // Now update local gold balance AppEnvironment.Instance.CurrentUser.GoldBalance = user.GoldBalance; } }