Querying owned purchases does not set refunds as not purchased
Closed this issue · 5 comments
I am using the queryOwnedPurchasesOnConnected
option. Everything works great.
However I am then calling initQueryOwnedPurchases()
further down the line when I know a purchase has been refunded. This correctly re-fetches the owned purchases, and adds any new purchases to this.purchases
.
However if a previous purchase has been refunded in the meantime this is not correctly removed from this.purchases
before invoking the listener. Calls to isPurchased
for the refunded product still (incorrectly) return true
.
isPurchased
property directly evaluates Purchase.PurchaseState .
It might be that is it a case of Google Play caching, where it might take for up to 72 hours for it to register the refund.
This can be tested by clearing Google Play cache, restarting and checking initQueryOwnedPurchases()
again.
After that, this.purchases
should not include a refunded purchase at all.
I may be mis-reading the code, but after calls to initQueryOwnedPurchases
the addOrUpdatePurchase
function is eventually called with each returned purchase.
The logic in that function will add new purchases, but it won't remove old (refunded) ones.
Next time isPurchased
is called on the refunded product the products
variable still contains the out-of-date purchase with the incorrect Purchase.PurchaseState
.
No, you are correct.
I suppose the solution is to clear the active purchases during initQueryOwnedPurchases
.
I will push an update for that.
This issue is fixed in 2.3.0
Thanks a lot - your fix worked