Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 579
ank3it Avatar asked Jun 25 '14 05:06

ank3it


2 Answers

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.

like image 184
MaxM Avatar answered Sep 21 '22 06:09

MaxM


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

like image 44
Marcel Friedrich Avatar answered Sep 20 '22 06:09

Marcel Friedrich