Hi there!
I'm testing the login/logout system of the RevenueCat SDK on Flutter.
I'm using the Transfer Purchase behavior from https://docs.revenuecat.com/docs/restoring-purchases.
Problem: PurchaserInfo entitlements returns empty after Purchases.logOut()
. Purchases.getPurchaserInfo()
only returns correct after I refresh the app and call Purchases.setup()
.
Steps to reproduce:
1. Enter app, call Purchases.setup()
(without appUserId).
2. Do a subscription purchase
3. Now with the user with subscription, call Purchases.login()
. The user now has a provided app id and has the subscription entitlement.
4. Call Purchases.logOut()
. Now the user has an anonymous id.
5. Call Purchases.getPurchaserInfo()
to retrieve the user's entitlements and check if the user has subscription.
Result: the user has no entitlements, even tho the user bought the subscription on that same device.
But…
6. Refresh the app and call Purchases.setup()
. Now when Purchases.getPurchaserInfo()
is called, it returns the subscription bought by the user.
Am I doing something wrong? should I call Purchases.setup()
after Purchases.logOut()
? Also, I'm calling setup every time the app opens up, is this correct?
PurchaserInfo entitlements returns empty after logOut
Best answer by ryan
Hey
The behavior you’re describing actually sounds like the intended behavior - calling .logOut()
should clear the PurchaserInfo cache and reset the App User ID. At this point the new user should not have access to the subscription.
RevenueCat ties subscription status to an App User ID, not a device, so when the App User ID gets reset it’s not expected for them to have subscription access even if the device does. To regain access, this new App User ID would need to restore purchases.
🚨You should not call Purchases.setup() multiple times - this should only be called once to configure the SDK. Calling this multiple times will configure multiple instances of Purchases, unless you are very careful about managing each instance you may run into trouble where a purchase is made on one instance but you’re checking the subscription status on another instance.
The behavior you’re seeing
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.