0

My app uses google's billing API to retrieve subscription options configured in google's developer console. We have some subscription options configured as free trials.

So far we've been using the IInAppBillingService.getSkuDetails() method. This reference - https://developer.android.com/google/play/billing/billing_reference.html#getSkuDetails - shows what kind of data you can retrieve data regarding the subscription item. But sadly it does not include the trialPeriod nor billingPeriod.

I stumbled upon this google play API https://developers.google.com/android-publisher/api-ref/inappproducts that shows you can query the in-app products and get a response with more details.

Is this information somehow available using the IInAppBillingService ?

drorsun
  • 881
  • 1
  • 8
  • 22

1 Answers1

2

There is currently no API that returns the info if a subscription is bought directly or through free trial.

Haven't tried it myself yet, but a workaround I could think of is to have different periods for an actual subscription and a trial period. Say have an actual subscription to have a minimum of 1-month subscription, then for a free-trial, have it as 1-week. (The difference in periods kinda gives the free trial a demo-like thing into it too)

With that done, you could call Purchases.subscriptions.get (or depending on how you're getting the subscription details, so long as you get the details) to receive a Purchases.subscriptions resource.

From there, you could compare the startTimeMillis and expiryTimeMillis. If it's 7-days, it's a trial, else, an actual subscription. (similar idea as to what was mentioned in this answer.

With all that said, I would like to point out that I'm not entirely sure if this is good practice in determining free trial subscriptions.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281