Skip to main content

Here I am instantiating the Purchases SDK:

So according the docs, if I do not provide the app user ID, the Revenuecat should generate one:

 

But when I try to print the app user id, it is returning null? Also I am confused with Purchases.logIn() and Purchases.logOut() methods as I can not figure out their purpose. Can someone also explain the following scenarios:
 

1)Let’s say user purchases subscription successfully and exits the app(not log outs, just closes the app) and when the user opens the app later how do we know that user is premium user?

2)Let’s say user purchases subscription successfully and accidentally deletes the app. When the user downloads the app again how we gonna restore his purchase? I know there is Purchases.restorePurchase() but how does it know if the user has purchases the subscription before? Can you please explain it? 

P.S. Do not mention the docs please explain it in a simple way if possible. 

 

Hi, you are correct that an anonymous user should be created upon your call to configure without having a custom app user id. Can you please run debug logs and share them here so we can see if a user is being created?

  1. The app user id is cached so the $RCAnonymous id will be the same. This id is cleared when the app is deleted.
  2. Purchases are associated with the underlying store account, so as long as the user is still logged into the same Apple or Google Play account that made the purchase, then restoring purchases will see those associated with the store account and will send that receipt to RevenueCat.