Skip to main content
Question

Paywall present even though a user with a given apple account already made a purchase

  • January 29, 2025
  • 1 reply
  • 21 views

Forum|alt.badge.img

Hello,

I am testing purchases in a sandbox environment and I don’t understand one thing (is this expected behavior ?) this is IOS app written in swift, using firebase for authentication
step1: A new user opens the app and chooses to sign in via Apple account (provided by firebase auth)
step2: They are presented with a paywall, they make the purchase and continue using the service.
step3: They press “logout” which triggers firebase auth sign out and


Purchases.shared.logOut { custInfo, err in
                if let err = err {
                    print("Error while logging out revenuecat: \(err.localizedDescription)")
                } else {
                    print("Log out successful from revcat and firebase")
                    completion(nil)
                }
            }



step4: The user logs in again via the same apple account
step5: The user is presented with a paywall again, even though the purchase was already made for this account.

I am setting the user’s ID after logging in to the firebase’s UID one:


   Auth.auth().addStateDidChangeListener() { auth, user in
            if user != nil {
                self.signedIn = true
                Purchases.shared.logIn(user!.uid) { customerInfo, created, error in
                    if let error = error {
                        print("error occured: \(error.localizedDescription)")
                    }
                    print("created successful: \(created)")
                    print("Logged in to revenuecat with userId successful")
                }
                print("Auth state changed, is signed in")
            } else {
                self.signedIn = false
                print("Auth state changed, is signed out")
            }
        }


Is this intended behavior?

This post has been closed for comments

1 reply

joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 406 replies
  • January 31, 2025

Hi ​@localhostcruiser,

If a user logs in and that account has an active entitlement then they should not be presented with the paywall again.

When you logIn the user the 2nd time, do they have an active entitlement by then? You can check it in RevenueCat customer history. Since in sandbox the subscription durations are a lot shorter than in production to be able to test more cases, it could be possible that is already over on the 2nd log in.

I’d try granting a user a year entitlement through RevenueCat and check that on the 2nd log in, it works or not.

If it doesn’t work, I’d like to double check that the id from the log in is exactly the same as the previous one. You’ve mentioned they are using the same Apple account but we don’t know that unless the user performs a restorePurchases or you call syncPurchases. In order to get the active entitlements straight away, the id you are using both times must be exactly the same.

Let me know if that works or we need to further debug the issue!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings