views:

76

answers:

3

Hi there, there are some apps that seem to recognize the iPhone's iTunes user. I need to develop an app that supports In-App Purchase of kind "Subscription". Apple wants that my app grants the subscription in every user's device (iPhone, iPod, iPad). To do so I can build a server-side subscription system that binds the subscription with a kind of just created user inside my server. To do things better I suppose that if my app can know the iTunes user that subscribes my service on the iPhone, it can store it inside my server. If the user download the app on an iPad too, my app can ask the server to understand if the current iPad user is the same that subscribed my service on the iPhone and, if so, can grant the service on the iPad too. So, can my app know what iTunes user is subscribing my service (with an In-App Purchase)?

Thanks In Advance

A: 

You don't have to know the iTunes account for this (in fact, I think there's no way to find out in a documented way).

On every device, you can restore previous purchases by calling into the IAP service. This will return a list of previous purchases that were made using the current iTunes account. You should communicate with your app server to get the content based on these restored purchases.

From the IAP Programming Guide:

To restore transactions, your application calls the payment queue’s restoreCompletedTransactions method. For each nonconsumable purchase that was previously completed, the App Store generates a new restore transaction. The restore transaction includes a copy of the original transaction. Your application processes restore transactions by retrieving the original transaction and using it to unlock the purchased content

Philippe Leybaert
As the IAP Programming Guide states, this is true only for "nonconsumable purchase". I need to manage "subscription purchase" so I need to implement this mechanism by myself.
Oscar Peli
A subscription product is also a nonconsumable. Restoring purchases works for these too
Philippe Leybaert
Are you sure? from the IAP Programming guide i read: "Subscriptions and consumable products are not automatically restored by Store Kit. To restore these products, you must record the transactions on your own server when they are purchased and provide your own mechanism to restore those transactions to the user’s devices."
Oscar Peli
A: 

The SDK agreement seems to say that your app will be rejected if you ask and require the user to send you their iTunes user account ID.

You will have to figure out a way to use the anonymous transaction ID instead.

hotpaw2
As told before it needs to "provide your own mechanism to restore those transactions to the user’s devices." So I can build a user/password system to bind to every transaction but this is really ugly!
Oscar Peli