I'm looking for a way to tie my user to an Apple Id. I want to prevent multiple users from using the same Apple Id in-app purchase. I am assuming this is the point of "adam_id" in the receipt json. My question is how do I set it? I would set it during the subscription process and then verify it belongs to the specific user on my server before unlocking app content. How do you set the adam id of an in-app purchase? Thanks!
IAP "adam_id"
Suggest you copy/move this to theIn-App Purchase forum.
>"I want to prevent multiple users from using the same Apple Id in-app purchase."
It's hard. Apple wants a user to be able to purchase multiple devices and use the app from any of those devices. You need to allow that. And Apple wants to protect the privacy of their users from app developers so you can't get their Apple ID for their iTunes Account.
You can write some identifier in the user's iCloud key-value file that is connected to that user's iCloud Account. Then each time you run the app look at that ID and make sure it is consistent with the user's claim to the IAP. Tell the user they need to be logged into their iCloud Account to buy the IAP. For example, user A buys the IAP and that fact is recorded in their key-value file. User A buys a new device and restores the IAP to that device (but in restore, and in 'repurchase for free', do not make a record in the user's iCloud Account key-value file). User A borrows his friends device and logs into his (user A's) iTunes Account and iCloud Account (worst case) and restores the IAP. Now the IAP can be used in all three devices. But when user A logs out of his iCloud Account and iTunes Account on user B's device, the IAP can only be used on 2 of the devices - the ones that remain logged into user A's iCloud Account. The problem with this approach is that some users will buy the IAP while logged onto their iCloud Account 'W' and then change to their iCloud Account 'X' and complain that the IAP no longer works. You need some way of handling such users.