Skip to content

Commit

Permalink
Validate iOS purchases on restore
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian1989101 committed Jan 22, 2019
1 parent 1b1876f commit 7e09535
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Plugin.InAppBilling.iOS/InAppBillingImplementation.cs
Expand Up @@ -108,10 +108,14 @@ public async override Task<IEnumerable<InAppBillingPurchase>> GetPurchasesAsync(
.Select(p2 => p2.ToIABPurchase())
.Distinct(comparer);

//try to validate purchases
var valid = await ValidateReceipt(verifyPurchase, string.Empty, string.Empty);
var validPurchases = new List<InAppBillingPurchase>();
foreach (var purchase in converted)
{
if (await ValidateReceipt(verifyPurchase, purchase.ProductId, purchase.Id))
validPurchases.Add(purchase);
}

return valid ? converted : null;
return validPurchases.Any() ? validPurchases : null;
}


Expand Down

0 comments on commit 7e09535

Please sign in to comment.