Unwanted behavior on Android when allowing purchase transfer

  • 19 September 2022
  • 3 replies

Badge +3

Platform: Android
Store: Google Play
Product Type: Monthly Subscription
RevenueCat Purchases Version: com.revenuecat.purchases:purchases:5.1.0



I am facing a situation that I'm not sure how to properly handle, related to restore behavior.


Up until now, our project had the "Restore behavior" option to "Block restores". 

Now, we want to start allowing users to restore their subscriptions.


The problem is that the Android app has unwanted behavior if we turn that "Restore behavior" option to "Transfer purchases" - to quote the documentation


"Due to platform limitations, purchases will be transferred as soon as you call `configure` if a user's purchases are already associated with another app user ID.

This may cause unexpected transfers of purchases between app user IDs, especially for apps with optional logins or users with multiple devices. To prevent this behavior, you should wait to call `configure` until you have the appropriate app user ID for your customer."


The app has optional login - meaning you can use a limited subset of features without an account.

This means that if I call `configure` - like I do currently on app startup, if the user is not logged in at that point, then any already existing purchase (associated with the Google Play account) is attempted to be transferred from the old app account which has a proper user id to an anonymous user id - via the `TRANSFER` webhook event.

The documentation says "you should wait to call `configure` until you have the appropriate app user ID for your customer"

--- but I need RevenueCat to be initialized before that point, so I can get data related to the subscription offer, which is advertised in the UI before the user is signed in. Example: "Try now for 7 days".


Accessing the Purchases instance to get that data without calling `configure` beforehand would result in the following exception: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance.


I'm a bit stuck here and I'm not sure what to do. We could, of course, ignore the `TRANSFER` webhook on our backend if the `transferred_to` array doesn't contain a proper user id that is stored in our database, but is that something that is safe to do on our side? Won't RevenueCat get out of sync with our server in that case?


I highly appreciate any input here.

Thank you!


3 replies

Badge +4

The problem with only initializing the SDK after sign-in with an app that has optional sign-in, is that users will be locked out of the purchases if they later sign out or don’t sign in

Userlevel 1
Badge +8

@Radu S @dkobia Did you get any response back from the RevenueCat team? We have the same problem and was going to implement your above approach. Have you experienced any problems with only configuring RC after login?

Do you also have the call the login() function?

Badge +5

I have the same exact issue with having the optional login. The only thing that seems to solve it is calling configure immediately after the user signs in instead of when the app loads, otherwise the transfer is made to the anonymous user.