Google Play帐单方法"queryPurchaseHistoryAsync"没有得到所有购买 [英] Google Play Billing method "queryPurchaseHistoryAsync" not getting all purchases

查看:260
本文介绍了Google Play帐单方法"queryPurchaseHistoryAsync"没有得到所有购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的应用程序中有4种订阅类型.两个月(一个折扣)和两个每年(一个折扣).我正在测试步骤中.当我询问购买历史记录时,我并没有获得文档中所述的每种类型的所有最新订阅.而且我购买的商品也不是每种SKU类型的鞋the.有人遇到这个问题吗?

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.

我检查了Google Play控制台的订单管理,并在Google Play应用中也看到了购买的商品,所以我不知道出了什么问题?

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?

推荐答案

不提供代码段就很难理解您的情况.但是,这是 queryPurchaseHistoryAsync 的常规实现.如果仍然有问题,请提供更多上下文,例如您的实际代码段以及进行呼叫的位置.对于以下代码段(仅用于测试),我正在打电话给 queryPurchases .

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.

这篇关于Google Play帐单方法"queryPurchaseHistoryAsync"没有得到所有购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆