7

I'm new to the implementation of Google's Billing library and using this system to make subscriptions inside my app. My question is if a user created a subscription which has free trial, used it completely and cancelled the subscription. If the user try to subscribe again then will the Google play billing library system handles the free trial eligibility for that particular user or we need to handle it in our code.

Can you please suggest if there is any process to check if the user already availed his free trial? If so, then proceed with charging the user for the subscription trying to subscribe

Kamal
  • 453
  • 1
  • 10
  • 22

1 Answers1

2

Google will handle it for you: https://developer.android.com/google/play/billing/subscriptions#ft-ip

SkuDetails.getFreeTrialPeriod() returns the free trial period configured in Google Play Console. It's possible the user has already used a free trial. In this case, Google Play communicates to the user that they are ineligible for another free trial.

romainsalles
  • 2,051
  • 14
  • 17
  • 11
    Considering this is from Google, I find this piece absolutely ridiculous and uninformative. *````SkuDetails.getFreeTrialPeriod()```` ... communicates to the user that they are ineligible for another free trial* - how? The method returns ````null````? An empty string? Throws an exception? Or should the eligibility param be obtained through a different mechanism? – Vym Jul 14 '21 at 19:52
  • 1
    According to the doc they said: "Note: Returned only for subscriptions which have a trial period configured." Which means this will return a value if the product is a subscription product && it has a free trial period (regardless of if the user had already used another trial period). Else, it will return an empty string. (The internal implementation uses JSONObject.optString(...)) – Mahmoud Nov 29 '21 at 07:53
  • Do we have any update on this question – Vikas Dec 16 '21 at 14:52
  • basically your should say that a user may try to use free trial even he already used it, so no need to write any logic on app level, then Google Play will handle it automatically – user924 Jan 06 '22 at 13:44
  • Someone who makes a wrapper SDK for IAPs says you have to check for earlier purchases: https://community.revenuecat.com/sdks-51/how-do-i-check-the-user-s-eligibility-for-intro-pricing-and-free-trials-on-android-163?postid=316#post316 – mpartel Feb 02 '22 at 06:30