Solved

syncPurchases on every fresh install

  • 2 February 2024
  • 2 replies
  • 36 views

Badge +2

Is there any reason _not_ to call `syncPurchases` on every fresh install? That way if a user has a pre-existing subscription, we’ll know right away.

The RevenueCat documentation lists these considerations:

https://www.revenuecat.com/docs/restoring-purchases#considerations

But if the user has an anonymous ID, calling syncSubscriptions will just discard that anonymous ID the user does in fact have a subscription (I believe).

I don’t see any downsides to it, but I could be missing something.

icon

Best answer by Ryan Glanz 6 February 2024, 18:26

View original

2 replies

Userlevel 3
Badge +8

Hi,

We have another warning on this page:

 

Do not sync or restore on every app launch

It's okay to trigger a sync once per subscriber programmatically the first time they open a version of your app containing RevenueCat. You should not call this programmatically on every app launch for every user. This can increase latency in your app and can unintentionally alias users together.

 

If you didn’t configure with an appUserId, then you’ll start aliasing anon ids together.

Badge +2

Thanks @Ryan Glanz . My approach is to store a flag in device storage recording whether I’ve synced purchases on that device. For every fresh install, that flag will be undefined, and so then I’ll sync purchases, and set the flag to `true`.

Reply