Question: using the Google Play BillingClient 1.1 how can I get only unconsumed purchases?
Background:
In our Android app we wanted to change the "old" billing libraries (using the V.3 IabHelper.java class from the examples) using the new
com.android.billingclient:billing:1.1
The idea was to use
BillingClient.queryPurchases(BillingClient.SkuType.INAPP)
in order to get a "history" of all purchases the user made. This is what the API tells (https://developer.android.com/reference/com/android/billingclient/api/BillingClient.html#queryPurchases(java.lang.String)) and it works fine. In the old version one would only get the unconsumed items which is useless for something like a "purchase history". However if I want to know whether there are unconsumed items, I can no longer get that information.
Same for queryPurchaseHistoryAsync()
.
The Purchase objects don't seem to contain any information about their consumption. How can I get only not-consumed items (or at least filter them)?
Please note, I'm aware that the purchases eventually have to be managed on our server side. However until this is successful, it would be good to know which item was "redeemed" (consumed) already or not. So I can't rely on our backend only.
---- EDIT ----
The Purchase objects (JSON) coming from the query all look like this:
{
"orderId": "[Id]",
"packageName": "[just the app's package]",
"productId": "[the SKU name]",
"purchaseTime": 1531224460215,
"purchaseState": 0,
"purchaseToken": "[a purchase token]"
}
So nothing that appears to be a consumption state.
---- EDIT 2 ----
I found a (bad) solution for it. When trying to consume a purchase, google tells me with it's return code whether it was already consumed or not. But that is not a solution for us since we wanted to keep it "marked as unconsumed" until it's redeemed on our server.