You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Play内购querySkuDetailsAsync接口未返回商品状态问题咨询

Solution for Handling Inactive SKU Status in Google Play Billing

I totally get the frustration here—Google Play's SkuDetails object doesn't expose the active/inactive status of products directly, even digging into originalJson won't give you that field. Here are a few practical workarounds to achieve what you want:

  • Maintain a local/backend SKU status mapping
    This is the simplest client-side approach. Create a static list or fetch a remote config that maps each SKU to its active status (you can sync this with your Play Console manually or via automation). For example:

    val skuStatusMap = mapOf(
        "premium_monthly" to true, // Active
        "premium_yearly" to false, // Inactive
        "basic_tier" to true
    )
    

    After fetching SkuDetails via querySkuDetailsAsync(), iterate through the list and cross-reference with this map. You can then filter out inactive SKUs entirely, or flag them to render with a grayed-out UI and "即将上线" label.

  • Use the Google Play Developer API
    For a more dynamic, automated solution, you can leverage the Google Play Developer API (note: this needs to run on your backend, not the client app, since it requires OAuth2 authentication). The products.list endpoint returns each product's status field, which can be ACTIVE, INACTIVE, or DRAFT.
    Your backend can periodically fetch this data and expose an endpoint for your app to retrieve the latest SKU statuses. This way, you don't have to manually update a local map every time you change a product's status in the Play Console.

  • Implement the display logic
    Once you have the status info, adjust your UI accordingly:

    • To hide inactive SKUs: Filter the SkuDetails list before passing it to your adapter, removing any entries marked as inactive.
    • To show grayed-out items: In your adapter's onBindViewHolder, check the SKU's status and apply a disabled style (lower opacity, gray text) along with a "即将上线" (Coming Soon) badge.

Just a heads-up: If you go the local mapping route, make sure to keep it in sync with your Play Console changes—nothing's worse than showing an inactive product as available, or vice versa. For the Developer API approach, add caching on your backend to avoid hitting rate limits.

内容的提问来源于stack exchange,提问作者Russ Wheeler

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 05:30:48