I have an app where you can make an in-app purchase under your account. When the purchase is made, the account is set as "premium" (on my external API), so if you log in with the same account on any other device, you'll get the premium content.
Is it necessary to have a "Restore purchases" button in my case ? If it is, what will the button do, if you already can see premium content?
Since you are using in-app purchase you should probably have the button, you could set as an action a verification at the user's account on your server to see if he has premium or not.
Related
After reading Apple's terms with my average English I understand that all application who sell non-consumable item need to use the IAP and insert a "restored button" if not the application is rejected by apple.
My user need to be connected to an account to play in my game and the IAP is attached to his account. And the non-consumable item is a money that he can spend. So I can't add a "restore button"...
So my question is, compared to my project do I really have to install a restore button? And if yes, how?
Update
I found my answer :
Apple documentation
So I don't need a restored button because I've sell consumable item.
The simplest solution is to look, how other similar apps work.
Add a restore button somewhere in settings. User taps the restore button.
If user is logged in, then his balance is automatically restored from the account on your server and you just tell him, that his balance is restored.
If he is not logged in, you should tell him, that he should login to restore his balance and then show him a login view.
All this should be reproducable by AppStore's app tester.
I'm currently implementing In-App Purchases in my Swift app. The product is a non-consumable one which activates a kind of Premium version for the user. Usually, with non-consumable purchases, you have to put a "Restore Purchases" button in your app (mandatory). However, my problem with this is: The app, and therefore the purchase, is user-bound. So every user of the app has to register an account with us. As soon as an user purchases the IAP, the user account gets flagged as Premium internally on our server. Once he logs out and logs into another account for example, the purchase gets "deactivated" as during the login process the app gets info from the server whether the user is Premium or not.
So basically, if I'd put a "Restore Purchase" button in my app it would either be kind of useless as the purchase gets activated anyways as soon as the user logs in, or the button would make it possible for someone to purchase the Premium version once and then activate it on an unlimited number of other accounts, too, simply by logging into them and "restoring purchases".
So, question is: Is this button mandatory in my case? I've seen other apps, especially subscription-based ones do this, too.
If you don't implement restore button for your in-app purchase implementation, Apple will reject your app.
Their idea is if any iTunes user has paid for some content, he should be able to access the content on any device.
How you are using the receipt and allowing the user that's up to you.
Is "Restore Purchase" button mandatory for iOS App submission. I have included Auto-renewable purchase in my application. I am showing the purchase screen First then only user can use my application.
if "Restore Purchase" button is mandatory, I need to show that button when it is required right?. so Is there any way to find out when "Restore Purchase" button should show?
Or else , can we show "Restore Purchase" button without considering whether user already purchased or not
FYI,
I tried to get the receipt from the Bundle.main.appStoreReceiptURL.
Then I tried to verify the receipt. If It is successfully verified, I
know the user has purchased or else I will show the purchase screen
Is it correct?
can we show "Restore Purchase" button without considering whether user already purchased or not
The whole point of the Restore Purchase button is that you are in a situation where you don't know whether the user has purchased. Only the Store knows that, and you have to let the user communicate with the Store through your app.
So, if you know that the user has purchased, fine, you know it, and there is no need for a purchase dialog / offer or a Restore button. But if you don't know it, then you know nothing. Any time you offer the user a chance at a purchase, you must offer a Restore button as well.
When user had purchased your app earlier and due to some reason he/she has uninstalled from his/her device or he/she wants to install in some other device with same apple ID(In order to enjoy purchased benefits). Over here, restore button comes into picture. Whenever we install an app from appstore, sometimes purchase verification get fail and app show itself in a normal form so overcome this situation(or any other where purchase has failed and user feels that it is being purchased), apple has asked the developer(you can see this thing in their documentation also) to provide a restore button.
Now coming to your point
"I tried to get the receipt from the Bundle.main.appStoreReceiptURL. Then I tried to verify the receipt. If It is successfully verified, I know the user has purchased or else I will show the purchase screen"
As long as you are taking the receipt data from this URL(appStoreReceiptURL) and verifying it correctly(hope you are verifying it from the apple server) everything else is fine. On the basis of that you can show or hide the restore button.
In IOS you can check if the user can make in app purchases with this:
SKPaymentQueue.canMakePayments()
I was wondering, if the user cannot make payments can they still restore purchases (for example if the app has just been reinstalled if the user can tap a restore purchase button to get back their inapp purchases)?
Restore purchase functionality will pick up the iTunes credentials from Settings and hit the Server for with those details alongside the app details. So if there ever has been a purchase made from that account for that app, then the user will receive his purchase otherwise blank response, which needs to be handled on client side.
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.