Skip to main content

My paywall has dynamic terminology for if the user has access to a 7 day free trial or not and I want to determine if the user is eligible for the free trial offer I have setup for my subscription on ios and android.

My app is built in react native and I’m using the react-native-purchases library from RevenueCat.
I know for IOS I can use the 

const eligibility = await Purchases.checkTrialOrIntroductoryPriceEligibility(t"myPackage"]);

but for Android this isn’t available/doesn’t work.
For Android can I fetch the offerings and check the introPrice field in the product and if it isn’t null I can assume that they’re eligible to use the free trial ?
 

const offerings = await Purchases.getOfferings();
const annualPackage = offerings.allo"myPackage"]?.availablePackages.find(pkg => pkg.packageType === "ANNUAL");

if (annualPackage && annualPackage.product.introPrice != null) {
setFreeTrial(true);
}

 

Hi ​@jordan-b72f22,

You are right, checkTrialOrIntroductoryPriceEligibility only works for iOS and will not return a valid eligibility on Android. For Android you can check `subscriptionOptions` to see if there are offers available. You can read our documentation here about how to handle the eligibility.

 

Best, 


Thanks Joan for your response.

Just to confirm when you say to check ‘subscriptionOptions’ is the code below sufficient to achieve that?

const offerings = await Purchases.getOfferings();
const annualPackage = offerings.all."myPackage"]?.availablePackages.find(pkg => pkg.packageType === "ANNUAL");

if (annualPackage && annualPackage.product.introPrice != null) {
setFreeTrial(true);
}

Thanks :) 


Hi ​@jordan-b72f22,

I mean to use the subscriptionOptions that you can find in the storeProduct, like this:

val freeTrialOffer = storeProduct.subscriptionOptions?.freeTrial
val introductoryOffer = storeProduct.subscriptionOptions?.introOffer

Best,


Reply