In App purchase

Hi Support team,


I am developing an app where I am implementing In App purchase functionality.


Can you please let me know how I can implement In App purchase where, the user can buy the upgraded version of the app through In App purchase ONCE and only for ONE device? That's all.


He should not be allowed to restore purchase the same app which he has bought once in different devices, even if he uses the same apple developer account. And, I do not want to use the server based solution for this.


Eagerly waiting for a positive answer.

Thanks

Replies

The types of IAP products are described here:


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


You can restrict an IAP to one device only if the IAP is a "consumable". Otherwise Apple requires that you distribute the IAP to all devices owned by that user. If your IAP is a consumable then implementation is straightforward; you do not provide any restore functionality.

Thanks, PBK.


However, what happens if , the user's device, where he has bought and downloaded once, gets faulty and all data/apps in that device gets spoilt. So, in a condition where he has to buy another device, how does he restore back the bought software in the new device?

Here are two comments from you:

>the user can buy the upgraded version of the app through In App purchase ONCE and only for ONE device

>in a condition where he has to buy another device, how does he restore back the bought software in the new device

These are not consistent. Chose 1.


Non-consumables allow the user to execute a restoreCompletedTransactions and recover their IAPs on any device that downloaded the app from that user's iTunes Account and is logged into that user's iTunes Account - that means new devices purchased by that user (and a few nefarious 'steals' by good friends of that user, perhaps).


Consumables do not allow restoreCompletedTramsactions. If you wish to allow the user to transfer the purchase to other devices you can use the user's iCloud account to switch to a new device. Record the device's identifierForVendor in their key-value file on iCloud. If they change to a new device offer them the ability to switch to that new device, but restrict that ability - for example, only 3 devices at one time or one switch per week or never back to the same device.

Thanks again for your answer PBK.


However, the two conditions are inter related to each other in my case.


Condition 1 - I do not want to give the facility of Restore Purchase.

Condition 2 - But, in the case of the device where we have downloaded the app getting broken or non-functional, how do we give the user facility of installing the app in another device? Not similar to restore purchase but installing in place of the previous device.


So, your response in the last para gives me the answer. We can tweak it in the icloud's 'identifier for vendor' key value and set a condition for the app installed ONLY in the current device.


Can you please help me in knowing , how do we do that?

I added an explanation to #3 in my original answer. Which step do you not understand?


1) If you wish to allow the user to transfer the purchase to other devices you can use the user's iCloud account to switch to a new device.

2) Record the device's identifierForVendor in their key-value file on iCloud.

3) If they change to a new device offer them the ability to switch to that new device,

(Explaination - the app always looks at their key-value file to check the active identifierForVendor. If it discovers a value for active identifierForVendor that is different from the device's identifierForVendor it checks the list of used identifierForVendors. If it sees its identifierForVendor on that list it issues an alert saying 'invalid device'. If it does not see its identifierForVendor it issues an alert asking if the user wants to transfer the permission to use the IAP to this new device. If the user says 'yes' then it records its identifierForVendor as the active one and moves the previous active identifierForVendor to the used list.

4) but restrict that ability - for example, only 3 devices at one time or one switch per week or never back to the same device.

Thanks once again PBK.


It is quite clear for me to start the development process now that, you have explained #3. Let me start coding and if, I get stuck anywhere, will contact you once more.


One last question in this round please. (Based upon your explanation for #3)


When we move the previous identifierForVendor to the used list through coding, does this make the previous device inactive for this app as well? I mean, is there any extra process to deactivate the identifier from the device end?


Thanks

>When we move the previous identifierForVendor to the used list through coding, does this make the previous device inactive for this app as well? I mean, is there any extra process to deactivate the identifier from the device end?


As far as the IAP is concerned, yes, "the app always looks at their key-value file to check the active identifierForVendor"

As far as "this app" is concerned, no, the app works on all devices, it's just the consumable IAP rights that can be made specific to one device.