IAP: Auto-renewable subscriptions by own system user account

Hi, I am trying to implement IAP with Auto-renewable subscriptions in my app......................
My app has his own system of users and I want to implement this behaviour: In the same device, if the user logged buy a subscription, then the user logout and other user login, I want to this user can buy is own subscription.......................
All the information about what user has buy the subscription, with all the info about the transaction can be save in a server side, when the user which is logged is not the user which bought the subscriptions, but still this user can not buy a subscription because it show a popup which said "Cannot connect to itune store". ........................
There is a way to implement this behaviour? or for each Apple ID only can be one subscription active at the same time?
There is a way of with same Apple ID, to different users of my own system account of my app logged can buy two subscription?


Replies

It is difficult to understand your question. Please try again. If you are writing on an iPhone then you can't keep line-breaks. Use something like this ....... to indicate a new paragraph.


The error message "Cannot connect to iTunes Store" can be caused by many different things.


If you want one device to allow multiple users with different AppleIDs to access the same subscription then simply write something to the app's file system when any one AppleID registers a subscription. Then other users of that app will be able to use the subscription.


If you don't want multiple users with different AppleIDs using the same device to all benefit from a subscription then you can record the subscription status on the user's key-value file in iCloud and check that each time the user wishes to use the subscription..

You wrote below:


1) There is a way to implement this behaviour? or for each Apple ID only can be one subscription active at the same time?

2) There is a way of with same Apple ID, to different users of my own system account of my app logged can buy two subscription?


IAPs are granted to the AppleID that the user is using. If two different users use the same AppleID then Apple treats them as the same user. That means the second user, logged into the same AppleID, cannot purchase a new subscripotion of the same IAP. (It also means that the second user, logged into the same AppleID, can get a 'restore' or a 'refresh receipt' that indicates they have purchased that same subscription.)


If you want to allow a second user of the same AppleID to be able to purchase a 'second subscription' then you can create two IAPs. Display only the first IAP to a user that does not have an active subscription. Display only the second IAP to a user who has an active subscription. Call the second IAP something like "duplicate subscription for a second user". Your system will need to handle one AppleID having two different 'user accounts' on your system.

If a user swicthes devices and logs into their AppleID on that different device then Apple will respond to a restoreCompletedTransactions, a refresh receipt and a purchase. In the case of a purchase by a user who has an ongoing autorenewable subscription, the user will not be charged again and updatedTransactions will be called with a state of purchased and a new receipt showing the latest purchase.


Apple's business model is that a single user would have multiple devices (iPhone, iPad, new iPhone) and a single IAP must be active on all of those devices (except for a 'consumable IAP').

Hello....

When i am done above process that you mention its give message purchase successfully and then "Cannot connect to iTunes Store"...
can you sugesst what to do in that case

"above process that you mention its give message purchase successfully and then "Cannot connect to iTunes Store"


"Cannot connect to iTunes Store" is a default error message that StoreKit sends.

Please describe the messages sent to StoreKit, who is logged in, when the AppleID of teh device is changed, and the calls StoreKit makes back to you in "...above process that you mention...".

> Is there any way to test in app purchase (of production enviroment) using test flight ?


While you can test many things in TestFlight, TestFlight IAP is all done in the sandbox environment.

>... its give message purchase successfully and then "Cannot connect to iTunes Store"...

can you sugesst what to do in that case



Suggest you see this link from the IAP FAQ:

Cannot connect to iTunes Store