Question

How do I automatically restore an in-app purchase on first install?

  • 26 June 2024
  • 2 replies
  • 35 views

Badge +2

I am currently porting a Java Android app that doesn’t use RevenueCat to a Flutter Android app that does use RevenueCat. I have a single IAP for “pro mode” that is marked as consumable in Google Play but not consumable in RevenueCat.

Once I launch this update I don’t want all my users to have to manually click my restore purchase button. I tried using syncPurchases() during first launch, but it takes two launches for this to take effect. I was able to make it work with restorePurchases(), but there are warnings in the documentation that this might prompt a login and I shouldn’t use it.

What is the best practice here?


This post has been closed for comments

2 replies

Badge +4

Hi there,

 

At which point to you do the syncPurchases()? If it works at the 2nd launch it looks like maybe you are doing it before logging the user in?

Also I got a bit confused by the fact that you have a consumable in Google Play but not consumable in RevenueCat, is there a reason for it?

 

Thank you,

Badge +2

Maybe I am confused about identity in RevenueCat. Without RevenueCat on Android, the purchase is linked to the Google Play account they used to download the app. Is this not the account RevenueCat looks at?

The syncPurchases() call is made during app launch during a “loading”-type screen.