Skip to main content

For my product, users frequently download the app after subscribing by first redeeming a promo code.

Sometimes, on a fresh install, RevenueCat automatically syncs a user’s subscription. Other time, it does not and the user has to tap our “restore” button, calling restorePurchases, making for a confusing UX. After much testing, I cannot explain this discrepancy.

What is the best way to ensure that the user’s subscription restores/syncs preemptively, so I can present the correct onboarding process? 

Calling syncPurchases does not seem to help at all. I’ve tried it before sign-up (anonymous user ) as well as after sign-up (after calling logIn and setting the user ID with RevCat).

The docs indicate that syncPurchases should successfully sync the subscription like restore does:

This method, much like restorePurchases, reactivates any content that had previously been purchased from the same store account (Apple, Google, or Amazon).

This answer from the RevCat team specifies about anonymous ids: 

syncPurchases unfortunately won’t work at fresh app install on a new device for anonymous ids - for custom ids, it will work like a restore, but for anonymous ids, it just syncs the receipt on the device. So if there is not a receipt on the device, it definitely won’t work (still silently).

However, the Flutter library here would indicate that perhaps it doesn’t work the way I’d like in either case:

This method will send all the purchases to the RevenueCat backend.

 

In short, syncPurchases doesn't appear to work like restorePurchases, from my testing. 

If I call restorePurchases during sign-up (trigger by the user), this successfully restores the subscription and allows the user to continue with the correct UX. Is that acceptable to do once during sign-up like this? I don’t want to rely on the user to manually “restore” in this case.

What am I missing about all this?

 

Hi @djsjr! When you refer to a “promo code”, are you talking about iOS offer codes? Or, have you implemented other discount flows, like Stripe checkout, for example, that your users first go through before downloading your app? 

Assuming this is iOS and offer codes, we do generally recommend kicking things off with restoring purchases (for new users). The SDK should pick up purchases from the iOS transaction queue for a fresh user, but there can be issues due to the asynchronous nature of the process, Apple’s transaction queue, etc. syncPurchases isn’t guaranteed to fully update the receipt, so that might be why it’s not working in this case, particularly if it’s called with an anonymous user (as you noted).

If you’d like to email support, we can take a deeper look at your purchase flow, but generally, restoring purchases for this kind of flow is recommended.