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:
-
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? -
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?