Open githubsoooh opened 5 years ago
I agree with @githubsoooh , Digging into the code v2.0.3, it reads the following:
/** Returns the state of purchase. */
public @PurchaseState int getPurchaseState() {
switch (mParsedJson.optInt("purchaseState", PurchaseState.PURCHASED)) {
case 4:
return PurchaseState.PENDING;
default:
return PurchaseState.PURCHASED;
}
}
There is basically no way of handling canceled/refunded purchases...
I confirm also that I reached the same issue. When this issue can be fixed ??
It seems that purchases and other information queried are cached, so after refund, if you do not want to implement your own purchase check with a backend, you have to wait that BillingClient cache is automatically reset.
I think that this issue can be closed
What if we don't want to use a backend to check refunds/cancelled purchases?
I found a workaround and wrote the details here: https://issuetracker.google.com/issues/73982566#comment62 Can you folks working on the Billing Library confirm if this is safe or not until you'll provide a real solution?
+1
Also wanted to check this with a built in method but sadly seems to not exist. What I came up with is checking if the purchase has been acknowledged, if it's not acknowledged its basically awaiting a refund.
In case it has been acknowledged and the purchase state is 0, I think you can consider it refunded. Otherwise the purchase state would return 1 if it still was registered as a purchase.
+1
`Inventory() { }
The user refunded, but getPurchase returns a non-null value.