I'm refactoring in_app_purchases
and I'm trying to get the past purchases. According to the documentation:
The InAppPurchaseConnection.queryPastPurchases method has been removed. Instead, you should use InAppPurchase.restorePurchases. This method emits each restored purchase on the InAppPurchase.purchaseStream, the PurchaseDetails object will be marked with a status of PurchaseStatus.restored
But the example they provide doesn't get the past purchases, it adds the one you buy at that moment.
I moved from this:
final QueryPurchaseDetailsResponse purchaseResponse =
await _connection.queryPastPurchases();
to this:
final Stream<List<PurchaseDetails>> purchaseUpdated = inAppPurchase.purchaseStream;
print(purchaseUpdated.toList());
I tried the above but the list is empty and for sure my user has purchases as I can show here when I try to buy the same version I bought before:
How could get a List
from previous purchases?