android - Google Play 结算库 : Determine base plan/expiry of subscription purchase

标签 android in-app-billing android-billing play-billing-library google-play-billing

我正在使用 Google Play Billing Library 5 并且有一个具有不同基本计划的订阅产品。
在处理 PurchasesUpdatedListener 中的购买时或在 queryPurchasesAsync 的回调中,我收到了 Purchase 的列表包含产品 ID、购买时间以及是否自动更新的对象。
但是我怎么知道用户选择了哪个基本计划,以及它何时到期?PurchaseHistoryRecordqueryPurchaseHistoryAsync 返回似乎也不包含此信息。
我知道 Play Developer API 返回到期时间
purchases.subscriptionsv2.get ,但是直接使用API​​的不便是必要的吗?

最佳答案

我得出的结论是,最好忽略整个多基本计划功能。
而是单独创建订阅,以便您拥有
Silver_Plan_Monthly --> Silver_Monthly_Base --> Silver_monthly_free_trial_offer。
然后单独订阅。
Silver_Plan_Yearly --> Silver_Yearly_Base --> Silver_yearly_free_trial_offer。
依此类推,无论您想要多少订阅级别,白银、黄金、白金等。
这样,当您获得用户购买时,您可以立即通过 productId 知道他们购买的子/级别/续订期,这将是订阅名称 (Silver_Plan_Monthly)。
这很烦人必须创建所有这些子,但计费库没有提供足够的信息。
您现在应该能够在这些级别和计费周期之间轻松升级/降级用户。

关于android - Google Play 结算库 : Determine base plan/expiry of subscription purchase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72351253/

相关文章:

android - InappBilling 错误 - 需要身份验证。你需要登录你的谷歌账户

android - 识别退款的 Play 商店下载

google-play - 我的 Google Play 控制台中的订单管理几乎只有 "test orders"

android - ImageView 上方的按钮?

android - 如何处理错误 : failed linking references

java - 使用 onTouchListener 旋转图像而不缩放图像

android - 具有自己的网络服务器的一致安全的 Google Play 应用内购买场景

android - 如何编辑我的 mysql 数据库?

android - 检查我的无服务器 Android 应用程序中的应用程序内订阅是否处于 Activity 状态

android - In App Billing getPrice() Android