Subscription management with iTunes id (restrict the user from creating multiple subscription on same iTunes ID)

apple-idin-app-purchaseitunes-store

I am working on an Auto-renewable subscription based application. We are using In-App purchase (StoreKit) option for the payment.
I have 2 subscription plans.

  1. Monthly subscription

  2. Yearly subscription

At the time of registration, the user should purchase any of the subscriptions mentioned above.

The problem I am facing can be stated as follows:

-> The Apple device is logged in using an iTunes id itunesone@gmail.com

-> One user say, userone@gmail.com creates an account in my app, and purchase a monthly subscription plan.

-> Now the purchased subscription is associated with iTunes id itunesone@gmail.com

-> Now, suppose if a second user say, usertwo@gmail.com tries to create another account with the same iTunes id itunesone@gmail.com

-> My requirement is that I should not allow the user to create a second account with the same iTunes id. How can I accomplish this?

-> If I allow the user to proceed and if the user tries to buy the same Monthly plan, apple store will return something like You are already subscribed to this plan. But if the user tries to purchase the second plan, that is the Yearly plan, An upgrade will happen which will completely mess up my backend.

-> Is there any way to get some data which will uniquely represent each iTunes id? So, using this I can solve my issue. Or else what I can do to stop the user from creating another account when there is already a subscription exists with the same iTunes id?

Note: Restore purchase was one option(not a good option, still). But it will confuse the user when there is a fresh registration happens and I don't think that is a good approach.

Best Answer

The user's iTunes ID differs from their Apple ID. It is easy to 'share' your iTunes ID but hard to share your Apple ID.

Your concern is a valid one but for a different reason. No need to be concerned about two different users purchasing two different subscriptions. But you could be concerned that two different users will share their iTunes ID and both benefit from a single purchase.

One approach is to forget about it; it's a theft but not necessarily a loss of a real sale. Another approach is to associate each purchase with the user's Apple ID using their iCloud key-value file. Use that key-value file to implement your own restoreCompletedTransactions. Do not allow a repurchase for free.