Disable restore IAP when same Apple account but different user account in application

In my app I have items to show just for users that are paying subscription. User can log to app by e-mail and password and can logout and on same device can log different users. Just classic custom account system.


My problem is that Apple Id in phone is still same. So when different user logged in he could restore purchases even that he didn't buy them.


So my question is how can I fix it? How can I connect Apple account to my custom account? Or at least somehow when trying to restore IAP check that this Apple account already have this subscription but different user was logged in. How other apps do this? With iCloud or server-side settings or what? Thanks for help


P.s.: Is there a difference in this if I am using Auto-renewing and non-renewing subscription? I mean I know differences between them I just want to know if there is different solution to my problem if I use one or another.

>My problem is that Apple Id in phone is still same. So when different user logged in he could restore purchases even that he didn't buy them.


A user can only restore purchases that they purchased through their iTunes Account. They must know their password for their account. The system requires a password for any restoreCompletedTransactions request or a receipt refresh. If two users share an iTunes account then they share all of their purchases. There is no way to distinquish them. If two people share their phone then they both get to use the apps and IAPs on that phone. Very few people share their phone. iPad sharing is a different matter.


Regarding 'restore'...an autorenewable subscription can do a restore through iTunes and the comments above apply. A non-renewing subscription cannot. You must implement your own restore function for a non-renewing subscription. Because of my concerns, similar to yours, that a company might purchase one subscription and post their account ID and Password for all of their employees, I limit the number of devices that can share a single subscription to 5 devices. If a user wants more than 5 devices they can use a 'Contact Us' button and request additional copies.

My problem is that user can buy subscription with one account (itunes account, apple id) and in my app I send info about this to logged user and in server I have info that this user has bought subscription. But when user logged out and logged in as different user and do same process as before then his subscription is restored and I send info to my server that this user bought subscription too but it's not true. He can then logged in to app in different device with different apple id but has subscription because I have info about this on server. One user can create multiple accounts with my custom account system and then share these accounts with friends and others.

I am not sure if I can explain it correctly. But I need some way to check if logged user bought auto-renewing subscription with that apple id or not. Or maybe do it different way if user try to buy subscription but it's already paid then say: "Sorry but on this Apple Id another user bought subscription. Log in as different user or change Apple Id in Settings" or something like that.

Let me see if I understand. A user can log into your server under any one of many different accounts ("multiple accounts"). Then that user can log into iTunes using a single Apple ID ("single Apple ID iTunes Account") under which they have purchased a subscription. Then that user gets to transfer the subscription rights under their "single Apple ID iTUnes Account" to each of their "multiple accounts" under your server. Here's what you can do:


1) using a non-renewing subscription - record on the user's iCloud Account the fact that they transfered the rights to an account on your server and don't let them transfer that right to any other account on your server for each non-renewing subscription period (or let them switch accounts - but not duplicate accounts - on your server once or twice if you want). Use that iCloud Account to transfer the rights to a subscription from one device to any other device logged into that same iCloud Account. Limit the number of such devices to 5. Tell the user that if they want to transfer the subscription they need to contact you.


2) using an auto-renewable - you have to let themn 'restore' as many times as they want. So the question is what identifying characteristic is in a 'restore' that links the subscription? I don't know....check out the original_transaction_identifier - I think that will be the same on different devices. Perhaps the original_purchase_date will work. Take that identifier and associate it with their account on your server. Keep a "List" of those identifiers and their associated accounts. If a user tries to credit a different account with a subscription refuse to allow that either from a check on the server side or within the app (after downloading the "List")

Very helpful information, thanks. You mentioned that you can limit the number of devices to 5, how can you do that please!

Disable restore IAP when same Apple account but different user account in application
 
 
Q