Question

How to track purchases made by unauthorised user

  • 20 October 2023
  • 2 replies
  • 36 views

Badge +4

Hi RevenueCat community,

We are going to open part of our application to unauthorised users.
And we want our users to be able to purchase a Pro subscription before they even sign up.

Customuse backend handles RevenueCat webhook events and tracks user subscriptions to control access to features. But it works with real user id’s only.

Our thought was that after signing up, we could restore/transfer purchases made by anonymous user to the registered user (with a custom user ID) so that webhook event would be sent to our backend and we could assign the subscription. But it seems that instead of transferring, a simple aliasing takes place, and no webhook events are being sent.

We're sure this is a typical scenario, and would appreciate it if you could advise how to approach this?
How can we check on the backend side whether the user has active subscriptions in RevenueCat at the time of registration?

Sincerely,
Dmitry, Customuse


2 replies

Userlevel 4
Badge +8

Hi, this aliasing is happening because of how the login() method works, which is if you are logging in an anonymous id and a custom id already exists, then these will be merged: https://www.revenuecat.com/docs/user-ids#login-method-alias-behavior

What you can do is include a flag in your app that checks if you are using login() with an anonymous id, and if you are then you can check their customerInfo for the active subscription: https://www.revenuecat.com/docs/customer-info 

Badge +4

@Haley Pace Hi, thank you for the answer!

Reply