0

In my app, I require all users to create an account and subscribe before using. RevenueCat handles this. However, when a user who does not subscribe signs up/logs in on a users phone who does have an account, the entitlement transfers over to the other account. I want to prevent this. Below is my code that I have, would appreciate if any know knows how to do this:

Purchases.shared.purchase(package: pkg) { (transaction, customerInfo, error, userCancelled) in
    if userCancelled {
        print("User cancelled the transaction.")
        return
    }
    
    if let error = error {
        // Handle errors
        print("Error occurred during transaction: \(error.localizedDescription)")
        return
    }
    
    if customerInfo?.entitlements.all["All Access"]?.isActive == true {
        // Activate Account
        print("Account is active")
        DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
            authViewModel.isActive = true
            authViewModel.updateSubscriptionStatus(status: authViewModel.isActive)
        }
    } else {
        print("User does not have an active subscription.")
        self.isSpinningViewShown = false
    }
}

RevenueCat community told me to “Keep with original app user id”. I am trying to implement this, however, I do not know how to.

Etienne
  • 21
  • 3
  • It's not in your code. It's in RevenueCat config https://www.revenuecat.com/docs/restoring-purchases – Paulw11 Aug 23 '23 at 21:19

1 Answers1

0

This is configured in the RevenueCat dashboard. What you want is "Keep with original App User ID"

If an App User ID tries to restore transactions that are already associated with a different identified App User ID in RevenueCat, you can configure how RevenueCat should respond by changing the dropdown in Project Settings > General in the dashboard:

https://www.revenuecat.com/docs/restoring-purchases#keep-with-original-app-user-id

bze12
  • 727
  • 8
  • 20