Skip to main content
Solved

[Android] Identify package & trial eligibility on Google Play Store

  • December 13, 2022
  • 4 replies
  • 1026 views

Forum|alt.badge.img+5

I have one simple entitlement/offer/product (package) definition for a yearly subscription with a 7-day trial period for new users who didn’t have any subscription before.

Now, I would like to get the user’s eligibility for the trial period directly from Google Play, but as far as I see it, this is currently not possible. So instead, I’m using 

CustomerInfo.allPurchasedSkus.isNotEmpty()

to check if a user is eligible for the trial period. If this check returns true (it’s not empty), then it means the user has bought a subscription before and therefor is not eligible for the trial period.

Unfortunately, this gives me mixed results - sometimes this check works correctly and sometimes not. So my question is, what’s a 100% bulletproof way of checking a user’s eligibility for a defined trial period?

Best answer by cody

Hey @Chris1,

You’ll need to first sync the user’s purchases with `syncPurchases` or `restorePurchases` - more info here:

 

View original
Did this post help you find an answer to your question?
This post has been closed for comments

4 replies

Forum|alt.badge.img+5
  • Author
  • Member
  • 7 replies
  • December 14, 2022

I did some more investigation and I found a user which does not have any purchased SKUs on RevenueCat, but DOES have purchased subscriptions on Google Play. It means that there is an inconsistency between RevenueCat’s data and Google Play’s data. I guess the reason is that the sandbox is a bit different than production.

But the remaining question is: It is possible to trigger a sync, so any (missed) purchase on Google Play will be transferred to RevenueCat?


cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 501 replies
  • Answer
  • December 14, 2022

Hey @Chris1,

You’ll need to first sync the user’s purchases with `syncPurchases` or `restorePurchases` - more info here:

 


Forum|alt.badge.img+5
  • Author
  • Member
  • 7 replies
  • December 15, 2022

Thank you @cody! That did it - I’m now calling syncPurchases as soon as my app is started, so all information is in place once I show the “purchase a subscription” screen. 


Forum|alt.badge.img+3

If you have an asynchronous call to get available offers, and you need to first syncPurchases before you can actually tell us which offers are available, why don’t you just do that inline when getting the offers?

All the SDK is doing right now is pushing that onto us and adding the additional hurdle of knowledge acquisition that this is even necessary. I should point out that when actually sending the purchase request to Google Play, it does the right thing -- it does not offer the trial if the user has already had a trial.

Why doesn’t the SDK automatically syncPurchases and apply the logic to the returned Offerings/SubscriptionOptions/etc? Why make every app that uses RevenueCat and wants to show “Try Free” on their call-to-action button implement the same stuff?

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings