Google Billing Library - Check for Subscription free trial eligibility
Asked Answered
W

1

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

Whitethorn answered 8/7, 2021 at 13:28 Comment(0)
A
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.

Afrikah answered 8/7, 2021 at 13:42 Comment(5)
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?Playwright
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(...))Rhiana
Do we have any update on this questionLusitania
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 automaticallyPassion
Someone who makes a wrapper SDK for IAPs says you have to check for earlier purchases: community.revenuecat.com/sdks-51/…Leath

© 2022 - 2024 — McMap. All rights reserved.