Detecting whether the current subscription is in Trial for Google Play store?

馋奶兔 提交于 2019-12-01 15:05:03

问题


I'm trying to detect whether a user who has purchased my application through in-app purchase is in currently in Trial period or not.

For Apple (ios store) it was an easy flag which I could find in the receipt.

For Google Play, even though I'm making a server end call using the google play android developer API but the response itself does not contain any flags for me to understand whether the user is currently in paid or trial period.

Does any one have any smart suggestions of how to detect this in the google world?


回答1:


I checked the difference between initiationTimestampMsec and validUntilTimestampMsec. If it matches my configured trial period its trial.




回答2:


Actually it seems like this really ins't offered by V2 at the moment. The best alterantive that I have though of so far would be to keep track of the first time this purchase was made (e.g. reading it our from the first receipt that the user received for the purchase) and then comparing this timestamp to the current time using the duration of the trial period.

This can be read from trialPeriodof the InAppProducts.get part for the respective productId.

https://developers.google.com/android-publisher/api-ref/inappproducts

If anyone has a better solution, I would be happy to read it here.



来源:https://stackoverflow.com/questions/24400527/detecting-whether-the-current-subscription-is-in-trial-for-google-play-store

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!