问题
I have 4 subscription types in the app I'm developing. Two monthly (one with discount) and two yearly (one with discount). I am in the testing step. When I ask the purchases history I am not getting all the lasts subscriptions of each type as the documentation says. And also the purchases I get are not the lasts of each SKU type. Did anyone have this issue?
It's giving me problems with grace period as I don't get the last purchase I did so I don't get the updated expiry time.
I checked Google Play Console order management and I see the purchases, and also in my Google Play app, so I don't know what's the problem?
回答1:
It's difficult to understand your situation without you providing a code snippet. But here is a general implementation of queryPurchaseHistoryAsync
. If you are still having problems, please provide more context such as your actual code snippet and where you are making the call. For the following snippet -- just for testing -- I am making the call right before I call queryPurchases
.
private fun queryPurchaseHistoryAsync(){
playStoreBillingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.SUBS){
responseCode, purchasesList ->
if(purchasesList.isNullOrEmpty()){
Log.d(LOG_TAG,"history for SUBS is empty")
}else{
Log.d(LOG_TAG,"history subs has ${purchasesList.size} items : ${purchasesList.toString()}")
}
}
playStoreBillingClient.queryPurchaseHistoryAsync(BillingClient.SkuType.INAPP){
responseCode, purchasesList ->
if(purchasesList.isNullOrEmpty()){
Log.d(LOG_TAG,"history for INAPP is empty")
}else{
Log.d(LOG_TAG,"history INAPP has ${purchasesList.size} items : ${purchasesList.toString()}")
}
}
}
Also in my cases, I have no problem getting the purchase histories.
来源:https://stackoverflow.com/questions/57367238/google-play-billing-method-querypurchasehistoryasync-not-getting-all-purchases