Subscriptions and iTunes account change

After the following steps:

  1. User logs in to iTunes account
  2. User logs in to my app
  3. User purchases subscription through IAP
  4. User logs in with different iTunes account


If I change the subscription through IAP after these steps, I would get an error. That is fine but I have 2 questions:

  1. How does it know the account has been changed? Is it because the receipt of the new purchase does not agree with the previous receipt?
  2. I would like to prevent the error by blocking users from changing subscription plans if a different account is used. How can I know that a different account is used?

Thanks in advance.

Replies

What error?


Is this the "Current receipt invalid or mismatched ds person id" error?


If you're asking about dealing with fraud, see the IAP FAQ What can I do to help combat fraud during purchase transactions?

When the user changes their iTunes account they are a 'different' user. The different user did not make the original purchase (of the IAP or the app) and therefore can't change their subscription (or restore their IAPs). This inability prevents a user from purchasing a non-consumable IAP and going from device to device (of all their friends), logging into their iTunes Account, restoring the purchase and then logging out of their iTunes Account.


How does it know the account has been changed? Is it because the receipt of the new purchase does not agree with the previous receipt?


It is because StoreKit has access to the iTunes Apple ID of the user and recognizes that it is different.


I would like to prevent the error by blocking users from changing subscription plans if a different account is used. How can I know that a different account is used?


I don't think you can. That is Apple's information and I think you can't get it from the system. But the user usually knows exactly what is causing the problem. A user changes their iTunes ID only because they are trying to 'share' their purchase.

Thanks KMT and PBK. This is given as an requirement to prevent confusions. I guess we're not so strict on running on multiple devices.


If I keep the current receipt on a server, can I check by comparing with the receipt I get from current iTunes user?

> can I check by comparing with


You can try....whether or not there is an actionable path is another issue. Personally, I think that 'requirement' more about chasing ghosts, with a splash of paranoia tossed in for flavor, but, hey, your team is allowed to learn, same as the rest of us 😉


See the IAP FAQ: Receipt

>If I keep the current receipt on a server, can I check by comparing with the receipt I get from current iTunes user?


I cannot understand what you are asking. Please try to be more precise. What current receipt; check what; what current iTunes user?


Different iTunes Accounts are different users. Issue an error message; the user knows exactly what they are doing when they change iTunes Account.

Purchasing a subscription would update the app's receipt in the iTunes account. Another iTunes account's receipt of the same app should be different. If I store the receipt in my app's database, it should be similar to linking the app's account to the iTunes account. In other words, I'd check the database's copy of receipt and iTunes account's copy of receipt to determine if the iTunes account is changed.

What is " the app's receipt in the iTunes account"?


If you mean the receipt located in [[NSBundle mainBundle] appStoreReceiptURL] then say that rather than use a term that has a clear meaning only to you.


That receipt ([[NSBundle mainBundle] appStoreReceiptURL]) does not contain any information that reflects the purchaser's App Store account. The fields of that receipt are described here:

https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1


But if there were to be a difference, that difference would show up only after the user got the error message you are trying to avoid.


Again, don't worry about this error message. The user, who changed the App Store login username, knows exactly why they got it.