Question

Undo a transfer

  • 4 November 2023
  • 2 replies
  • 16 views

Badge +5

On my app, users can log in anonymously ( a skip button) or with a full account. Some users due to perhaps not using the app for a long time, have to resign in, but have a tendancy to “skip” when they come back. This triggers a transfer of their purchase to the new anonymous account.

It would be great to have a button in the revenue cat panel to undo a transfer or an endpoint I could ping to do so or a way to prevent transfers to certain users.


2 replies

Badge +3

Hey Paul.

Not sure I’m qualified to answer, since I’m just now implementing it in my own app for the very first time.

I have thought about the same scenario you mentioned. What I came up with for now is the following:

I have a local state “last_known_server_user_id”, which is also persisted locally.
This is used for initiating revenue cat. it is null, until a user signs in for the first time → then I set it as the user ID from the server, and also call LogIn with RevenueCat, linking the anonymous account (and potential purchases) to the server user ID.

Now it could happen that, as you mentioned, my server signs the user out after some time. In my implementation though, since the last_known_server_user_id is still locally persisted and used to initialize RevenueCat, the user still has access to their subscriptions.

If a user signs in to a different account, you call RevenueCat login again, as well as save the newly logged in server user id in the local “last_known_server_user_id” state. 
If the user signs out, you call RevenueCat.logOut, and save null in the local “last_known_server_user_id” state.

I can’t see anything wrong with that for now but if there is, please let me know.

Hope I could help you with my thoughts,
Jacob

Userlevel 6
Badge +8

Hey @Paul Finlay!

It looks like Jacob had a good idea to manage this, you can also set your transfer behavior in our dashboard: https://www.revenuecat.com/docs/restoring-purchases

If needed, you can manually transfer entitlements in our dashboard as described here: https://www.revenuecat.com/docs/active-entitlements#transferring-entitlements

Reply