google-play-services - 如何管理具有免费试用期的 Google Billing 订阅?

标签 google-play-services in-app-subscription

这是 Google Play 控制台中的当前测试设置:

  • Test product 1
    • Subscription base plan 1: duration 1 month
    • Subscription base plan 2: duration 6 months
      • Offer 1: 1 week free trial period

queryProductDetailsAsync 的结果是 3 个报价:

  • Offer 1
    • Pricing phase 1: P1M
  • Offer 2
    • Pricing phase 1: P1W (free)
    • Pricing phase 2: P6M
  • Offer 3
    • Pricing phase 1: P6M

该应用动态地向用户展示所有可用的优惠,以便可以通过 Google Play 控制台远程管理优惠。

问题是报价 2 另外出现在报价 3 之后。如果基本计划有报价并且用户符合条件,我想隐藏基本计划(报价 3) ,因为它有点多余,因为吸引力不如 P1W(免费)+ P6M(优惠 2)。

另一方面,如果用户已经订阅了 P1W(免费)+ P6M 并在免费试用期内取消,则他们不应获得 P1W(免费)+ P6M 但只有基本计划 P6M。我假设这已经由 Google Billing 管理,因为 queryProductDetailsAsync 应该只返回用户可用的优惠。

queryProductDetailsAsync 响应中,我看不到要约 2 正在使用要约 3 作为基本计划。它们显示为两个不相关的报价,这使得很难在应用程序中添加任何逻辑来隐藏基本报价。我能想到的唯一解决方案是使用 offerTags,向基本计划添加一个唯一 ID,以便能够相互关联。

如果优惠 2 也可用,隐藏优惠 3 的最佳方法是什么?

最佳答案

根据docs,标签似乎是谷歌打算使用的。 :

A tag is an optional label of up to 20 characters that you can use to mark or group base plans and offers and identify them in the API. Tags can be used to determine which offer to show when the user is eligible for more than one. You can add up to 20 tags. Users cannot see tags.

Tip: We recommend using tags to identify the offers created with developer-determined eligibility to help differentiate between them when showing the collection of offers available to the user.

这似乎是将报价确定为基本计划的一部分的唯一方法。这是令人惊讶的,因为 Google Billing 已经知道该优惠是基本计划的一部分,为什么我们必须乱用自定义标签来获取该信息?更令人惊讶的是,Google Billing API 5.0 直到最近(2022 年 5 月)才进行了重新设计,但缺少这种基本功能。

关于google-play-services - 如何管理具有免费试用期的 Google Billing 订阅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72940991/

相关文章:

android - 具有跨平台单点登录配置的服务器端访问不清楚

android - 使用最新版本的 firebase 的问题

android - 如何修复 Google Maps Android v2 上的语言环境问题?

android - GooglePlayServicesAvailable 何时返回 SERVICE_VERSION_UPDATE_REQUIRED?

android - 无法登录 Google Play 游戏服务

ios - 在 iOS 中存储自动续订订阅收据的最佳方式是什么?

swift - IAP 不显示在 TestFlight 中,但显示在 XCode 中

ios - 用于以下要求的应用内购买类型

flutter - Flutter flutter_in_app_purchases订阅FlutterInAppPurchses.instance.getSubscriptions()没有检索IAPItem的任何项目

java - 如何在应用程序订阅android中使用按比例分配模式