Can a user restore purchases if they cannot make payments? - ios

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.

Related

Appstore Flutter App Rejection Because of In app purchuase

My app is rejected because of in app purchase. I am using in_app_purchase 0.3.0+2. How can I put "Restore" button for ios?
We found that your app offers in-app purchases that can be restored but does not include a "Restore Purchases" feature to allow users to restore the previously purchased in-app purchases, as specified in the "Restoring Purchase Products" section of the In-App Purchase Programming Guide:
Users restore transactions to maintain access to content they've already purchased. For example, when they upgrade to a new phone, they don't lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button.
Next Steps
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 by the user. Note that
automatically restoring purchases on launch will not resolve this
issue.
you can use login/signup method for save all purchased account in your own server and the user can login with another device and login and then can restore purchased service. or you can just use apple id [queryPastPurchases] to get past purchases.

Apple In-App Restoring Purchases: Am I responsible for validating a purchase before I allow a “Restore Purchase” request to go through?

Am I responsible for validating a purchase before I allow a “Restore Purchase” request to go through? This is a non-consumable purchase. What's supposed to happen when a Restore Purchase request goes through for an apple ID that did not make the purchase?
The reason I ask is that when I was testing the restore purchase functionality, I first signed out of the sandbox test account which the original purchase was made on. And when prompted during the restore request, I signed in with an account that had not made a purchase, and the purchase (with the in-app purchase content) was restored just fine under that account.
Is that what would happen with any random user that hit the restore button? Here's apple's document on restoring purchases:
https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html
It mentions that the user will be prompted for credentials but it makes no mention of what it would do if it was a different app store account from the original. It might just be asking because it wants someone to be authenticated first.

In-App Purchase: "Restore Purchases" button on user-bound purchase

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.

Ionic 2 - How to validate whether the user is already purchased the item on App launch

I am using In-App purchase plugin to do the In App purchases from my App. it's non-consumable product so I tried to restore the purchase on every App launch but binary is rejected as we should provide separate button for restore purchases.
How we have to check whether the user has already purchased the item on App launch?
For iOS you must call getReceipt() then send this information to https://buy.itunes.apple.com/verifyReceipt (production) or https://sandbox.itunes.apple.com/verifyReceipt (non-published app) with HTTP. Then validate the response for the purchase. More here
You shouldn't call getReceipt() every load as it will ask the user to login. Rather store the purchase info in local storage or a database. If the user changes devices they can restore the purchase.

iOS InApp Purchase

I just wonder if there is anyway to check if a user(email) already buy an in app purchase item in my application.
For example I buy an item on my iPhone, then I log in on my iPad with same itune account. the application will know that this user did buy the item.
Thanks,
Huy
The same thing is happening when you use the restore purchased option in many applications.
SKPaymentTransactionStateRestored
is the constant retrieved from server when you tries to purchase an already purchased item.
Please check this nice tutorial about inApp purchase : inApp purchases
From the In-App Purchase Programming Guide:
Store Kit provides built-in functionality to restore transactions for
non-consumable products, auto-renewable subscriptions and free
subscriptions.
You can restore purchases with the StoreKit framework by calling the restoreCompletedTransactions method of the SKPaymentQueue. Your app will then receive a transaction for each product the user has previously purchased. Simply handle these transaction and unlock the features and/or download content on the new device.
If your product is a consumable (gold coins for your game, health packs etc.) this would not apply and you have to keep track of the purchases on your own.
You will need to set up a server that will keep track of each transaction. And you need to implement a method to authenticate the user across devices (signup via e-mail, Facebook login etc.). Once the user logs in on a new device, your server can tell the app what it should unlock/download.

Resources