My app uses custom user ids. When a user purchases a subscription, then logs out and back in with a different account, that doesn’t have the entitlement, a problem occurs. When pressing the purchase button, they get an alert that says “You are currently subscribed to this” and after pressing OK, the entitlement is also added to this account.
Now I have two accounts with an entitlement, but only one subscription.
I’m very new to this, but isn’t there any way to prevent this?
Or at least a way to check if this app store account already has a subscription, so I can give the user the option to restore it, instead of purchasing?
This seems to be an issue with restoring purchases which can sometimes get tricky with different situations. We have a useful document which goes over restoring purchases which can be found here: https://www.revenuecat.com/docs/restoring-purchases
Here we recommend to use transfer or block restores, this will help keep track of that original entitlement with the proper user.
This is currently not a straight up feature and can be tricky, you probably will have to dip into StoreKit for that. I will go ahead and submit this as a feature request for the team though!
I implemented restore purchases and it works correctly, the problem only seems to occur when repurchasing an item, that was previously purchased with a different user id. I found this apple forums article that mentions something like this: https://developer.apple.com/forums/thread/65210.
In the case above, it seems that the purchase likely transferred to the new user. You can check that in the customer history on the RevenueCat dashboard to verify.