Search code examples
iosin-app-purchasestorekitin-app

Differentiating two Users for In-App Purchases in Application to Buy Non-Renewable Subscription by different users?


I am implementing In-App Purchases first time in my application and new to In-app purchases Store Kit.

I have few doubts regarding In-app purchases:

  1. What happens if a user purchased a subscription and logged out from the application and another user logs in and trying to purchase the same?

  2. Does iTunes allow the second user to use the First user's purchased product?

  3. If it allows how can we handle the second user's subscription?

What details we will get post Successful/Failed transactions from itunes to save in my database?


Solution

  • For a non-renewing subscription then it is entirely up to you to track expiration and determine what content a user has access to and when.

    For example, say your subscription gave access to "the word of the day". If the subscription was active for the month of January, then the user would receive access to new words each day in January. The user should continue to be able to see January's words even after the subscription expires, but no new words.

    If they resubscribe in March then they would now get new words throughout March.

    You need to track all of this on your server against the user account.

    Non-renewable subscription IAPs act much like consumable IAPs. The "Restore purchases" Store Kit function does not restore non-renewable IAP items.

    To answer your specific questions:

    1. If a new user logs in to your account system in the app (but the same iTunes account is still active on the device) then a second purchase will succeed and you need to update the subscription start and end dates for the new active account on your server.

    You also need to cater for the following: - The original account logs back in; In this case the original subscription entitlements need to be available - The original or second account log in to another device; Again, the accounts subscription entitlements need to be available.

    1. No, since non-renewing subscriptions are not restorable, the second user cannot "use" the first user's subscription.

    2. You handle each account in your system independently.

    Information about the mechanics of the purchase process are described in the In App Purchase Programming Guide