如何使用 GoogglePlay 开发人员 API 检测 android 的应用内购买的计划变更?

How to detect plan change for android's in-app purchase using GoogglePlay developer API?

感谢阅读

上下文

我们提供点播视频流,用户可以在 android、ios 和网络

上通过按月或按年订阅来购买

因此,每当在 Android 上进行购买时,应用程序都会向我们的服务器发送一个 (purchaseToken, subscriptionID) 对,我们使用 this google developer API 来保存我们数据库中的订阅信息

问题

最近,我们添加了对用户在 Android 上更改计划的支持。在 Google 方面,按比例分配资金并创建新订阅。但是,旧订阅的开始和结束时间在开发者上仍然是相同的API。

我们不能肯定地说旧订阅已被取消并被新订阅取代,因为负载 (defined here) 仅告诉您上述自动续订状态。再加上 1 的取消原因涵盖了任何非用户发起的事情,而不仅仅是计划变更。

我正在解决这个问题,但这需要了解一些事情,例如:

这似乎很可能,基于此:

Google Play cancels the old SKUs and credits the user with the unused value of their subscription time on a pro-rated basis. Google Play applies this credit to the new subscription, and does not begin billing the user for the new subscription until after the credit is used up.

However, the old subscription's start and end time is still the same on the developer API.

这似乎出乎意料,可能是一个错误。

When you switch from a more expensive, longer plan (yearly) to a shorter one (monthly), will all the remaining money be prorated, effectively making your new subscription last longer than its normal duration?

是的,原始订阅的余额将应用于新订阅。一旦余额用完,新的计费周期将开始。这在文档 here.

中有最好的解释

When you cancel the newer subscription, will it happen the same way as cancelling a normal subscription? (i.e, the subscription is not auto renewed, but should stay in effect till the end of its duration), or some credit will be stored with Google to be used later?

我相信会发生的情况是订阅不会自动续订(如您所说),但订阅将保持有效,直到之前订阅的余额用完。