Starting with iOS 7, SKMutablePayment has an applicationUsername property that can be set when making a payment. And SKPaymentQueue has a restoreCompletedTransactionsWithApplicationUsername: method (link) .
The Apple Guide is to hash your server-side user ID and pass it on when you purchase and restore. So, in your case, if iTunes User A purchases a product, it will be tied to your server-side user ID for this customer. Then, if iTunes User B tries to recover, the restore will fail because they will still transmit the same user ID on the server side.
You will also have to monitor (on the server) that your server-side user ID has purchased the product. Otherwise, if iTunes User B tries to recover, you need to know the difference between the fact that they logged into the device with a different iTunes account and they never bought. And, of course, you also want the same server user to buy the product twice under different iTunes accounts.
Cautions:
- If you already have purchases made in production, this most likely will not work.
- iOS 7+
- The "already acquired" scenario that I mentioned above.
Deepfried twinkie
source share