gpt4 book ai didi

android - 如何确定用户是否取消了 Google Play 订阅?

转载 作者:IT老高 更新时间:2023-10-28 23:33:04 39 4
gpt4 key购买 nike

即将在我们的 Android 应用中构建订阅产品,但对于了解已取消订阅的最佳方式有点不清楚。我们计划让用户取消的唯一方法是让他们前往 Google Play 商店并明确取消,但在这种情况下,我们的后端不会收到通知。

Google Play 开发者 API 文档明确规定您不得向 API 查询所有订阅的状态,那么我们应该如何知道哪些用户取消了他们的订阅?

非常感谢任何帮助!

最佳答案

根据应用内订阅文档,没有检测用户何时取消订阅的机制。因为它不会立即取消。相反,它会等待订阅到期的周期结束。

文档摘录(source)

When the user cancels a subscription, Google Play does not offer a refund for the current billing cycle. Instead, it allows the user to have access to the canceled subscription until the end of the current billing cycle, at which time it terminates the subscription. For example, if a user purchases a monthly subscription and cancels it on the 15th day of the cycle, Google Play will consider the subscription valid until the end of the 30th day (or other day, depending on the month)

当用户取消订阅时,应用不会收到任何通知。

订阅的行为是每当您在应用中查询库存时,如果订阅有效,将返回 SKU。订阅到期后,查询库存时不会返回 SKU。

根据本 link 中的文档

只要订阅接近尾声,就可以运行批处理查询

文档摘录(source):

Query for subscription status only at expiration — Once your server has retrieved the expiration date of subscription tokens, it should not query the Google Play servers for the subscription status again until the subscription is reaching or has passed the expiration date. Typically, your servers would run a batch query each day to check the status of expiring subscriptions, then update the database

以下服务器 api 可让您查询订阅状态:

https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource-representations

autoRenewingcancelReason 变量会通知您订阅是否已取消。

通过使用上述 API,您将能够实现一个系统,其中可以查询即将到期的订阅状态,然后确定它们是否被取消。

有关取消订阅的详细信息,请访问 link .

注意:
文档指出,只要用户拥有有效订阅,您就应该继续提供内容。如果您打算在有人取消订阅的情况下拒绝访问该内容,则将违反 Google 政策

文档摘录(source)

Important: In all cases, you must continue to offer the content that your subscribers have purchased through their subscriptions, as long any user is able to access it. That is, you must not remove any content while any user still has an active subscription to it, even if that subscription will terminate at the end of the current billing cycle.

关于android - 如何确定用户是否取消了 Google Play 订阅?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37635996/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com