3 Replies
      Latest reply on Jun 8, 2018 10:44 AM by PBK
      acoleman772 Level 1 Level 1 (0 points)

        We have a client that wants the app to be free out of the gates, then limit funcationality and require an in-app $ after the user has logged a certain number of events. Does anyone have experience regarding the best way to set this up? APIs?

        • Re: Activate in-app purchase after utilization
          PBK Level 6 Level 6 (2,735 points)

          Yes, you create a consumable IAP that sells a bag of tokens in quantity 1, 5, 10 etc.  It costs one token per event.  You start the app by writing to the user's iCloud key-value file or their keychain a starting number of free events (e.g. you start with 25 tokens).

           

          The IAP could also give unlimited events after the user has used the first free events.

           

          Using the keychain means the user gets a new start on each device.  Using the cloud key-value file means the user gets a new start if they log in with a different Apple ID.  Using both is more restrictive. 

           

          The app "Lap Swim" starts with 250 laps.  After that an single IAP is required for unlimited laps.  The App VR-Pano starts with 10 free VR-Panos after which you can buy more.

            • Re: Activate in-app purchase after utilization
              acoleman772 Level 1 Level 1 (0 points)

              Thanks! Is there any code we need to be aware of when developing to ensure the event our client wants to track and eventually charge for is seen as "consumable"? Also, it looks like any events that are created prior to required purchase (so "consumable events") would not be stored or saved so when the users change devices they would lose this data? Is there a way to prevent that from happening?

              https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html#//apple_ref/doc/uid/TP40008267-CH2-SW2

                • Re: Activate in-app purchase after utilization
                  PBK Level 6 Level 6 (2,735 points)

                  >Thanks! Is there any code we need to be aware of when developing to ensure the event our client wants to track and eventually charge for (****) is seen as "consumable"?

                   

                  In iTunes Connect you enter the IAP as a consumable IAP (****) not a non-consumable IAP or non-renewing subscription IAP or an autorenwable subscription IAP.  In the app you have to do lots of things to handle the number of tokens/events (****) the device has purchased (or started with) including tracking that number in the keychain or iCloud key-value file.

                   

                  >so when the users change devices they would lose this data?

                   

                  If you store the number in iCloud this is not an issue unless the user changes their Apple ID.  If you store the number in the keychain then the user gets another set of free tokens/events each time they get a new device.  You could create some way of transferring purchased tokens/events **** from one device to another device (see the app VR-Pano).

                   

                  ****But what you first described may involve a non-consumable IAP after the user uses a fixed number of events.  In which case all you have to do is track the number of free events on iCloud or the keychain.  Once those events have been used you lock out further events until a non-consumable IAP is purchased.