iOS Restore IAP on other devices - ios

I have a non-renewing subscription in my app, and I'm looking for a way to restore it on other devices. I stored the datas on the user iCloud account, but when there is no account logged in, we can't store it and there is no way to get it on another devices. I don't have login system on my app, so I can't get user reference on database.
Please, is there a way to do it ?

That's what the "Restore purchase" APIs are for. Also, if a user buys the IAP again, they won't be charged, though Apple may object during App Review.

Related

iOS Check if an iTunes account is logged in

Is it possible to check if an iTunes account is logged into a device?
I have an in-app purchase setup and if the user makes a purchase I write to NSUserDefaults; however, if the iTunes account used to make the purchase is logged out (or another is signed in), NSUserDefaults isn't reset.
So, is there a way I can reset NSUserDefaults when an iTunes account is logged out. Or, perhaps there's a better way for me to determine whether or not the user has made an in-app purchase.
Thank you.
No. Instead, I would recommend using the built-in mechanisms to accomplish this.
You can see if the user has minimized the app and come back by subscribing to the UIApplicationDidBecomeActive notification (or using your UIApplicationDelegate).
Then, you should be able to simply restore the user's purchases using the StoreKit framework and compare against what you have stored for the current user to see if they have changed accounts.
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html

Is it possible to offer Apple's In App Purchases on an app that offers multiple user log-ins

We're designing an iPad app at the moment which offers in-app purchases for non-consumable items.
As the scope of the project has expanded, we want to allow the option to sign in to an account, and then sign out of that account and into another - similar to how one could on an app like the Facebook app.
My question is: is it possible to link Apple's in-app purchases to one of our system's user accounts, so that a User may sign in to a different device and access their purchases, but if another User signs in to my device, they cannot access my purchases (despite the device being signed in to my Apple ID)?
Any suggestions welcome
All completed in app purchases are tied to the Apple ID that was used at the time of the transaction. Since non-consumable in app purchases can only be purchased once, you can't use those. So, the only option would be to use consumable in app purchases and keep track of which system user account made the purchase. You need to store those purchase records on an external server somewhere though, since Apple will have no way of telling you which purchase went to which of your internal users. If you lose that purchase history your users will have to buy the item again, and probably not be very happy.

Made In app purchase Using with Device token or Apple ID

I am implementing In-App Purchase in my app and test around the existing apps to get some ideas. But I found a scenario which I am quite confused on it.
I have installed an iOS app and purchased the particular levels. Later I uninstall this app, sign out from existing iTunes store account and sign in again with another apple id, then reinstall that app again (same app). Here i can again i need to purchase the particular levels.But my doubt is In-App purchase method we can use based on the purchase Apple ID or Device token ?
If the user can purchased with Apple ID ,then the user can login with another device they no need to purchased again but one user can purchase app and user can login to another users Devices is the one problem..!why because another users no need to purchase.
And if we set the Device token, based on the in-app purchase user can only login that device only ,they can't login another devices with same Apple ID,here it is a problem.
I am quite confused on it... so is the purchased items tied on device if we use multiple apple ids on same device?
I understand that I can restore my purchased items on different devices using same apple id. But how about multiple apple id on multiple devices? If I have 2 apple id associated on an device, I use one of them purchased item, but later I use these 2 apple id login to another device, am I still need to pay again to download items I have purchased on previous device?
Please let me know if my questions are not clear... I hope someone can give some idea on sharing purchased items against different devices and apple ids.And which one use the in-app purchase.
Any suggestions and comments are welcome. Thanks a lot.
IAPs fall into two categories - consumable, and non-consumable.
Non-consumable purchases (purchase level 10-15 of a game, upgrade to pro, etc) are synced across devices by the system, and are restored by the system. They are tied to the Apple ID.
Consumable purchases (purchase 5 gold coins) are NOT synced or restored. Your application needs to remember that the purchase has been made, and store information about that so that a backup and restore correctly restores the user's state. If the user uninstalls and then reinstalls, they have lost any previous consumable purchases (but they will retain all non-consumable purchases, and your application can query for these). You can, of course, sync all information about consumable purchases to your own server, but you would then need to have the user create an account with you. This would allow you to sync consumables between devices.
The Device ID (which you can't get, anyway) has no relevance.
See https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html for more discussion.
If the IAPs are non-consumables (or autorenewables) they can be 'restored' by the user (i.e. the app would execute a restoreCompletedTransactions or refreshReceipt). I believe that the username/password log-in required to restoreCompletedTransactions (or refreshReceipt) must be the same username/password as the person who downloaded the app onto the device. Given that requirement, I still believe that a single 'purchaser' can share their single purchase of a non-consumable IAP on many devices.

Restoring "remove ads" functionality when using consumable IAP

I'm researching how to properly implement the functionality to remove ads in my app when the user makes any IAP and have that functionality restorable.
The way i'm seeing the first part done is to simply put a value in the user defaults that the user has made a purchase and check it before displaying ad. No problem.
But i don't know how to do the restorable part because all my products are consumables. How can I restore this value when the user reinstalls the app? Because as i understand the only record of a consumable is on the device and cannot be restored by apple correct?
Any help would be greatly appreciated, thanks!
You cannot do this purely through store-kit APIs, as there is no restorable purchase record as you say. I can see a couple of options -
You could enable iCloud for your app and persist data to the user's iCloud account, however this won't work for users who don't have iCloud.
You could have the users register an account on your server and use that to store their purchase history (or provide a Facebook login etc).
If a user deletes and re-installs your app then they need to make another in-app purchase to remove the ads - Profit!

Auto-renewable subscription model

Well, I am working on app, which is a basically free app to download, but the user has to sign-up through the app through an auto-renewable subscription.
Also every time when the user tries to log-in, my app will check for the subscription.
When the user tries to sign-up with the same user and but on another iOS device (with the different iTunes account), he/she has to buy the subscription again, as the device has the different iTunes account.
Along with that, if the user has bought the subscription from an Android device, he/she has to buy it again for the same username, if he/she wants to use it on an iOS devive and vice versa.
Now I am wondering whether this subscription model will be approved by Apple or not.
Or should I just change the subscription model to non-renewable subscription.
Thanks in advance.
-Shoan
Do you really want the user to pay for his subscription multiple times? Probably not...
You should manage the account on your server. If the user buys from the store when logged in, update your server data to reflect his extended membership. And it's your server that decides whether the subscription is still valid or not.
It really shouldn't matter which iTunes account or device he uses to buy/extend his membership.

Resources