How Inapp Purchase will work when 2 different user trying to access same application

If User A comes and purchases an AutoRenewable subscription now his subscription is already running and he logs out now User B registers in the same application on the same device and tries to purchase the same plan which User A previously did

In the above case How InApp will behave? and How we can detect that Apple id is already occupied with another user.

If User A has set their iTunes user account in the Settings app -> User Name, then when the auto-renewing subscription is purchased, the subscription will be for User A. Then if User A logs out of the Settings app and User B logs into the Settings app -> User Name with their iTunes account, the auto-renewing subscription will now be successful for User B.

However, if this is a StoreKit 1 app and USER A is logged, and in the app, the app user is User A, they can successfully make the In-App Purchase of the auto-renewing subscription. If User A logs out of the app, and now User B logs in, but the Settings app remains set for USER A, then when User B attempts to purchase the same auto-renewing subscription, User B may first need to know USER A's password to authenticate the transaction attempt, but then the purchase will likely fail as the auto-renewing subscription is already active for USER A. If this is the case you are asking about, StoreKit 1 requires the app to manage multiple logical users and the transactions made by these users. I leave it to other developers who have faced this issue to describe solutions they may have found successful.

If you would use StoreKit 2 in your app, there is support for associating an app specific identifier with a purchase. After the purchase is successful, then all queries about the transaction will include the app specific identifier. In this way the app can distinguish which logical app user made the initial purchase. Note StoreKit 2 requires the use of iOS 15.

rich kubota developer technical support CoreOS/Hardware/MFI

How Inapp Purchase will work when 2 different user trying to access same application
 
 
Q