Skip to main content
Solved

Behavior of Restoration When a New Purchase Is Tracked and Linked to an Anonymous App User ID

  • July 29, 2026
  • 2 replies
  • 16 views

Forum|alt.badge.img

I have a question regarding the behavior described in the documentation for cases where the appAccountToken for a transaction is not set.

 

Prerequisite 1: The logged-in user ID is specified as appUserId during SDK initialization.

Prerequisite 2: Transfer Behavior is set to Transfer to new App User ID.

 

Question 1. In this scenario, is it correct that the purchase history associated with the anonymous user will be re-linked to the `Custom App User ID` registered during initialization via the “transfer” process?

Question 2. Is the “transfer” handled automatically by the RevenueCat SDK or the backend? Or do I need to manually restore the purchase data?

Question 3. Is the Anonymous User App ID correct UUID format for appAccountToken field of transaction?

Question 4. To set the Custom App User ID, I’m initializing the SDK at login. Is this approach appropriate?

Best answer by Crudyg123

Hey ​@okada-amb ,

Yes, your understanding is generally correct.

If RevenueCat receives the transaction without an appAccountToken, it will initially associate the purchase with a newly generated anonymous App User ID. Once the SDK reports the same purchase using the Custom App User ID provided during initialization, RevenueCat will apply your configured transfer behavior. With “Transfer to new App User ID” enabled, the purchase and entitlement should be transferred to the Custom App User ID automatically. You should not need to manually call restore purchases for this flow.

The RevenueCat anonymous App User ID itself is not a valid UUID for appAccountToken, as it includes the $RCAnonymousID: prefix. Apple’s appAccountToken requires a valid UUID. RevenueCat’s SDK handles setting this automatically when the App User ID is a valid UUID; otherwise, the token may not be set.

Initializing the SDK with the Custom App User ID after the user has authenticated is appropriate. However, the SDK should only be configured once. If RevenueCat is already configured before login, you should call logIn() with the Custom App User ID instead of configuring it again.

I hope this clarifies the expected behavior.

2 replies

Forum|alt.badge.img+5
  • Helper
  • Answer
  • July 29, 2026

Hey ​@okada-amb ,

Yes, your understanding is generally correct.

If RevenueCat receives the transaction without an appAccountToken, it will initially associate the purchase with a newly generated anonymous App User ID. Once the SDK reports the same purchase using the Custom App User ID provided during initialization, RevenueCat will apply your configured transfer behavior. With “Transfer to new App User ID” enabled, the purchase and entitlement should be transferred to the Custom App User ID automatically. You should not need to manually call restore purchases for this flow.

The RevenueCat anonymous App User ID itself is not a valid UUID for appAccountToken, as it includes the $RCAnonymousID: prefix. Apple’s appAccountToken requires a valid UUID. RevenueCat’s SDK handles setting this automatically when the App User ID is a valid UUID; otherwise, the token may not be set.

Initializing the SDK with the Custom App User ID after the user has authenticated is appropriate. However, the SDK should only be configured once. If RevenueCat is already configured before login, you should call logIn() with the Custom App User ID instead of configuring it again.

I hope this clarifies the expected behavior.


hafizrahman
RevenueCat Staff
  • RevenueCat Staff
  • July 30, 2026

Hello ​@okada-amb ,

 

What ​@Crudyg123 explained is correct (thank you!)

About the fourth question, I’d just like to add that generally we suggest configuring the SDK as early as possible in your application lifecycle. If at that point your app already has the Custom App User ID, then you can pass it too. But if the login user action happens later on, then calling `logIn()` while passing the App User ID as ​@Crudyg123 mentioned is correct.

 

Best,