【问题标题】:Is it possible to detect a grace period via BillingClient?是否可以通过 BillingClient 检测宽限期?
【发布时间】:2021-10-30 05:45:11
【问题描述】:

我正在尝试使用 BillingClient 检测宽限期。

文档说:

订阅在其整个生命周期中会经历各种状态变化,您的应用需要响应每一次变化。要检查订阅者的状态,您的应用可以使用 Google Play 结算库中的 BillingClient.queryPurchasesAsync() 或 Google Play Developer API 中的 Purchases.subscriptions:get 进行查询。

不幸的是,在我看来,使用 BillingClient 无法区分有效订阅和宽限期。在这两种情况下,isAutoRenewing 标志都设置为true,而purchaseState1。至少当我尝试在测试环境中通过使用Test card, always approves 购买订阅,然后在续订之前更改为Test card, always declines 来重现这种情况时,我看到的就是这种情况。

有什么想法吗?

【问题讨论】:

    标签: android google-play in-app-subscription google-play-billing


    【解决方案1】:

    我不认为你可以,因为你需要Purchases.subscriptions:get API,如here 所述:

    订阅在其整个生命周期中可能会经历各种状态变化,您的应用需要对每个变化做出响应。要检查订阅者的状态,您的应用可以使用 Google Play 结算库中的 BillingClient.queryPurchasesAsync() 或 Google Play Developer API 中的 Purchases.subscriptions:get 进行查询。

    [...]

    宽限期如果:

    • expiryTimeMillis 在未来 // Purchases.subscriptions:get
    • paymentState = pending // Purchases.subscriptions:get
    • 自动更新 = 真。 // Purchases.subscriptions:get 或 BillingClient

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      • 2011-06-08
      • 2020-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多