Solved

How to reset purchases when users switch Apple accounts

  • 4 August 2021
  • 3 replies
  • 50 views

Badge

I noticed that when a user bought an IAP (no-consumable) on a macOS device, and then switched to a different Apple account, the new account still had access to pro features. I tried restarting the app and clicking the restore purchases button (which called `Purchases.shared.restoreTransactions`) but they didn’t help.

 

I think the cause is Apple doesn’t refresh receipts for apps when a new account is signed in. I’m wondering if that is expected and what is the best practices to deal with that (ex should we just ignore those cases or there is a method to refresh receipt explicitly (and if that’s the case, should we invoke that method on every launch?)).

icon

Best answer by ryan 4 August 2021, 18:17

View original

3 replies

Userlevel 4
Badge +8

RevenueCat ties the subscription status to an App User ID, not a device, which sounds like what you’re experiencing here. If you switched Apple accounts, but didn’t change the App User ID, the subscription status would not be cleared out.

You can use the .logOut() method in the SDK to reset the App User ID, or if this is a test account you may want to delete the App User ID from the RevenueCat dashboard.

Badge

Thanks for the quick response!

 

If you switched Apple accounts, but didn’t change the App User ID, the subscription status would not be cleared out

Then that makes it more like an iOS SDK specific question (It worth noticing that my app is a macOS app that uses RevenueCat's iOS SDK). My app doesn’t have an app user id so I just rely on the anonymous one set automatically by the SDK.

Seems like RevenueCat's iOS SDK won't be able to get notified when a user logs into another Apple account on the same device because as far as I know, Apple doesn't refresh receipt when switching account.

That leaves a question that as a developer, how can we ensure that when a user signs in to a new Apple account on the same device, we can reset all pro features if the new Apple account hasn't bought the IAP.

Userlevel 4
Badge +8

Seems like RevenueCat's iOS SDK won't be able to get notified when a user logs into another Apple account

That is correct. The iOS SDK does not get any alerts of what the underlying Apple account is or if it’s been changed.

 

as far as I know, Apple doesn't refresh receipt when switching account.

Not sure about this one, Apple should be refreshing the receipt automatically if the phone account changes but maybe things are different between macOS and iOS here.

 

how can we ensure that when a user signs in to a new Apple account on the same device, we can reset all pro features if the new Apple account hasn't bought the IAP.

I don’t think there would be a full-proof way to detect this with the iOS SDK. The subscription status is tied to an app user ID, which enables cross-platform subscriptions (e.g. Android to iOS). So just because the device does not have a subscription in the receipt doesn’t mean the customer didn’t subscribe from elsewhere (web, Android, etc.).

 

If you have requirements for more control over subscription / account switching it may be worth exploring an authentication system and requiring customers to create an account in your app.

Reply