2

I am creating an app in which i need to update UI based on Google Play Subscriptions

I have two cases in which i have problem

  1. is user used Free Trial Subscription
  2. Is user used Introductory based Subscription or not

I know it will automatic adjust when user try to payment. But I need this in to update App UI

enc_life
  • 4,973
  • 1
  • 15
  • 27
Vikas
  • 432
  • 4
  • 17
  • play api will provide u all related data. – Rohit Kumar Dec 27 '21 at 11:35
  • please check [this question](https://stackoverflow.com/q/40866990/7948109) and [this question](https://stackoverflow.com/q/41122253/7948109), these question contains information about how to check/get free trail – Rahul Gaur Dec 28 '21 at 04:56
  • @RohitKumar how? can you explain little bit in detail or any link ? – Vikas Dec 28 '21 at 12:56

3 Answers3

1

Google doesn't provide an API for this.

First option: If you're forcing users to sign in, then you can use Firebase RTDB to save the user's subscription/trail data and then you can listen to DB changes and update the UI on data changes.

Second one: You can use a service to track this data like Revenuecat. You can check Period Type from their API. I'm currently using it and it does the job.

Other than that, there's no way to get this information from Google yet.

tpbafk
  • 501
  • 5
  • 26
  • it Paid or Free service. Or are you able to track user has already used Free Trail or Introductory Offer ? – Vikas Dec 30 '21 at 14:17
  • @Vikas sorry for the delay. Yes. it's free up to $10K MTR. I'm also on the free plan and it's enough for me. And yes, you can thack that if a user has already used `Trial` or `Intro` (check the link in the answer). You can check the `Normal` period which is an ordinary subscription. BTW I suggested this service cuz I am using it and have some experience. I'm sure there are other services like this but revenucat's gonna solve your problem. – tpbafk Jan 02 '22 at 06:55
  • @tpbafl thanks i am going to try this. one more ques what is 10k MTR, its total subscription amount purchased by overall users or anything else – Vikas Jan 03 '22 at 09:42
  • @Vikas MTR means Monthly Tracked Revenue. Basically, it's the total monthly revenue of your app(s). – tpbafk Jan 03 '22 at 13:14
  • Also, If it solves your problem, please accept my answer :) – tpbafk Jan 03 '22 at 13:22
0

Currently, I don't think there is a way to get the details of free trial subscriptions as per google play API. So as per your use cases, we can make a workaround it.

We can use purchases.subscriptions.get to get the timestamp when the subscription was taken and once that information is with us we can compare the subscription taken the time and we can compare it with the current time. If that time exceeds the Trial days limit we will know that its a Introductory based Subscription.

Shubam Virdi
  • 144
  • 1
  • 4
  • you are talking about POST api ? – Vikas Dec 30 '21 at 14:16
  • this is a GET request as per docs but we need to pass a few params in it like packageName, subscriptionId and token. This endpoint has a try-it-out feature as well you can execute by passing details on the hyperlink to that request. – Shubam Virdi Dec 31 '21 at 11:40
0

You can check from server using paymentState for the same - check below link - https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions#resource:-subscriptionpurchase

PaymentState - 2 // for Free trial

Server can get the purchase details from here -

https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get#http-request

Atendra Singh
  • 396
  • 3
  • 9