Skip to main content
Question

Transition from Anonymous to Identified User server side

  • July 12, 2025
  • 1 reply
  • 14 views

Forum|alt.badge.img+5

Consider this scenario: the user account is only created in the database after the user subscribes.

Since I don't have a user ID initially, I initialize the Web SDK like this:

const appUserId = Purchases.generateRevenueCatAnonymousAppUserId();
const purchases = Purchases.configure({
  apiKey: WEB_BILLING_PUBLIC_API_KEY,
  appUserId,
});
 

Once the user account is created, I need to associate the existing RevenueCat data (based on the anonymous appUserId) with the newly created user ID. Based on the docs, it looks like I can create a new customer using the new user ID and then use the transfer endpoint.

Questions:

  1. If the destination appUserId doesn’t yet exist in RevenueCat, will the transfer endpoint create it automatically, or do I need to create it first?

  2. Is using the transfer endpoint the recommended approach for this use case? Or is there a better way to handle the transition from anonymous to identified user server side?

This post has been closed for comments

1 reply

Forum|alt.badge.img
  • RevenueCat Staff
  • 9 replies
  • July 18, 2025

Hey there! Thanks for reaching out.

 

Regarding your first question, yes, the user must exist before calling that endpoint or you would get a 400 error stating the target customer ID couldn’t be found.

If you wish to create customers programmatically, you could call the create customer endpoint and then listen for the resulting 201 status before calling the transfer endpoint.

Regarding your approach, this is not the most common case. We recommend authenticating your user with a custom ID as soon as possible in the app lifecycle, because if an anonymous user makes a purchase, we have no way to link their Entitlements if the user uninstalls the application. If that happens, they will lose access to their paid content, as the SDK will assign them a new Anonymous ID upon restart.

Bearing that in mind, your approach to use the API is a good one, but out of curiosity, I would like to know the reason behind that design decision.

Please let me know if you have any follow-up questions!

 

 

Best,

-- Víctor from RevenueCat


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings