In-App Purchases restore button necessary? - in-app-purchase

guys I've implemented an in-app purchase using PARSE. Now there is no restore button in my app . My DB, hosted on the PARSE cloud has a an attribute called "hasMadePurchase" in my User's table which is checked every time the user tries to make a purchase. The attribute is set to yes as soon as a successful purchase has been made.
Now with that, do I need a restore purchases button for the app to get it through the app store? Cause clearly, even if the user changes his/her device deletes and re-installs the app or whatever he/she will still be able to get all his/her purchases back.
If yes, than what do I need to implement in my restore function? (which would basically do nothing, other than making fake calls, i don't know i am kinda lost)

A restore purchases button is needed only if the app offers non-consumable IAPs, e.g. unlocking content. Our game got rejected recently exactly for this reason - we were offering weapon unlocks and we were missing the restore purchases button.
If you are offering non-consumable IAPs then you can start by looking into [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] and go from there. Basically, this fetches the list of all IAP SKUs that have been previously purchased by the user.

Related

Should I display Restore subscription button?

Is there really need in this button? When I verify a receipt and discover there is valid subscription, doesn't it uniquely say, that the subscription is valid and there is no need to run restore process? Or may be there are some cases when it's not possible to determine whether the user had the subscription, for instance on other device?
Your app will be rejected if you submit it with In App Purchases but no Restore button. Even if you have an home-made checking and don't see the goal of the button, add it.
If you try to submit it without Restore button you'll get this rejection message from Apple :
We found that your app offers In-App Purchase/s that can be restored
but it does not include a "Restore" feature to allow users to restore
the previously purchased In-App Purchase/s.
To restore previously purchased In-App Purchase products, it would be
appropriate to provide a "Restore" button and initiate the restore
process when the "Restore" button is tapped.
Don't play with Apple rules :)

How to check does user already bought app?

I've working code to make or restore purchase. I'm able to buy and restore.
My idea is to put two buttons on purchase screen: "Buy" and "Restore".
I want to eneble/disable those buttons depending on purchase status.
Simply:
If user not bought yet -> "Buy" enabled and "Restore" disabled
If user bought alredy -> no purchase screen :)
If user bought alredy and reinstal app - "Buy" disabled and "Restore" enabled
Of course I'm using standardUserDefaults but problem starts whe user reinstal app. My question is how to get purchase status from appStore (purchased or not yet)?
You shouldn't do this because Apple requires to always have a restore button or your app will get rejected.
You also shouldn't disable or hide the buttons depending if something was bought or restored.
If the user presses the buy button on a product he already bought he just gets the product for free again, you are never charged twice.
So I wouldn't even bother trying to do this. It also properly makes your users experience more confusing. Better to have a consistent shop experience that doesnt change all the time. Also users might be thinking there is a bug in your game because all they see is a button that doesnt work.
Maybe put a little tick or something next to the buy button if you want to indicate to the user that he already bought the item. You must have some sort of bool or other property that gets set, and saved in NSUserDefaults, once a product was bought. Just use that property to add or remove the tick/indicator.
If you are wondering how to handle the restore button on first press you should use the restore completed delegate method. There you can basically show 2 UIAlertControllers.
1 if nothing restored because nothing was previously bought and 1 that the restore was successful. Check this question I have answered recently for sample code. Restore Purchase : Non-Consumable
"We found that your app offers In-App Purchase/s that can be restored but it does not include a "Restore" feature to allow users to restore the previously purchased In-App Purchase/s. To restore previously purchased In-App Purchase products, it would be appropriate to provide a "Restore" button and initiate the restore process when the "Restore" button is tapped"

How to detect if user has made any in-app purchases?

My iOS app has in-app purchases (consumable) and shows ads periodically. The idea is to remove ads after user has purchased anything. But in-app items are consumable, so after user re-installs the app, I would be unable to determine if he has purchased anything using [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];, right? And I would bomb him with ads again...
What would you suggest to find out that the user has purchased anything already?
Well when a user re-installs your app (i.e. delete it and install it again) there is no immediate way of knowing what purchases did he made. That's why Apple requires your app to provide a way to restore previous purchases so that when the user performs this operation he restores these purchases for free.
For consumable items you might need to use a server for managing the purchases such that when the app loads it checks with the server which purchases the user has made and immediately enable the relevant content.
I do not know if mandatory but "Remove Ads" IAP should be non-consumable so the user will only need to purchase it once (Otherwise I believe users will complain or just won't buy it).
Some creative ways can be found here : iPhone - in-App purchase consumable correct approach
As an improvement on the situation, you could store the fact that a purchase was made in NSUserDefaults. That won't survive if the user uninstalls and reinstalls the app, but at least it survives if the user buys a new phone and restores a backup to transfer everything to the new phone.
You could have a look at Cloud Kit as well, which would store information per AppleId. It's a bit overkill for the problem, but it means you can use Apple's servers instead of your own for free. There would be a difference that if a user installs your app on six devices, makes a consumable purchase on one device, ads will stop on all of them.

in-app purchase restore button -- provide it even though one doesn't know whether or not the user has purchased the content?

I have had an app update rejected because I don't have a restore button for my in-app purchase. What I don't understand is -- when I first show the iAP to the user, I don't know if they have already made the purchase or not. Am I still supposed to show them the restore button?
For a question on how to implement the restore button, see Apple reject because of In app purchase not implement restore.
Imagine this: The user has your app and buys the IAP. They then get a new device and install your app. The first thing they want to do on the new device is tap on your "Restore Purchases" button so they get back their paid for content.
This assumes of course you are talking about non-consumables or perhaps subscription type purchases.
Basically, any app that sells non-consumables must have a "Restore Purchases" button. You should always show the button. Of course the user may tap the button and there may be nothing to restore. This is fine. Simply display a message telling the user that there was nothing to restore.

How to check already purchased InApp purchases on ios

I am working with InApp purchase, so I have implemented a working model,I have referred this
link http://xcodenoobies.blogspot.in/2012/04/implementing-inapp-purchase-in-xcode.html.
Here when the user purchases an item I store some value in KeyChain and I cross check with this value to confirm that the user has purchased the item and if not I will ask the user to purchase the item.
This works, but I have 4 products available for purchase, which can be purchased individually, So I thought of creating different instances of KeyChain and storing different passwords for these 4 products and cross check, but keyChain can only save one username and password.
So I want to know what can be the alternative for this.Also NSUserdefaults will not work, because it is tied to the App bundle and whenever user deletes the app, the data is lost and so he will be asked to purchase again.
Regards
Ranjit
If you're adding a restorable in-app purchase (non-renewable subscription, free subscription or non-consumable product), then the Store Kit API already provides the "restore transaction" functionality for you: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/MakingaPurchase/MakingaPurchase.html
In your UI, you need add a "Restore purchases" button to your product screen that calls the restoreCompletedTransactions method. This is important because Apple might reject your app if you don't provide this button.

Resources