Skip to main content

Hello, my user flow is like this:
- user purchases subscription (not logging in with Purchases.logIn() )→ Revenuecat generates an anonymous id → INITIAL_PURCHASE event is triggered

​​​- after purchase: the user logs in with Firebase auth (logging in with Purchases.logIn() after account creation) → No event trigger

I’m grating users credits on INITIAL_PURCHASE. My issue is now that there is no event triggered when logging in with custom app user id. I don’t have any reference to between the anonymous id and custom user id. 

Is there any way to get aliases with the custom user id as a query from the backend, or am I missing something?

Hey There,

 

One thing that you can do is with your current workflow, after the purchase happens and the users logs in, you call syncPurchases or have the restore purchase. This should create a transfer event which will help link that purchase to the new logged in app user ID. The event that woudl be generated by this would be a TRANSFER event. TRANSFER events happen when a transfer of transactions and entitlements was initiated between one App User ID(s) to another. Please note: The webhook will only be sent for the destination user despite us displaying this event in both customer histories because the event body is exactly the same for both users.  

 

Calling login will not generate an event, so another good workaround for this will be changing your flow to make the purchase after configuring the SDK with the specific ID or after logging in. That way the purchase will be linked to the proper account from the beginning and you wouldnt need to restore or syncPurchases.


Hey thanks for the reply! I added syncPurchases after login but it doesn’t seem to trigger a TRANSFER event.

Any idea why that is?


Hey ​@cemck ,

 

When then sync happens here is there a new app user ID for the user? Can you possibly provide a screenshot of the customer history for this user after the sync? 


Hey, 

I changed the backend flow. Im granting credits now with user create trigger and not using INITIAL_PURCHASE as before.

Thanks for the help though


Reply