how to detect that the app is previously purchased by user - ios

I recently changed my paid app model to in-app purchase model, its easy to detect that the users who already purchased the app will not get the in-app purchase options when they update the app.
But the problem if these users delete the app and download again or they download in new device, then how to detect that the app is previously purchased.
I am not talking about in-app purchase or restore purchase. I want to detect user who purchased app from app store not from in-app purchase.

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.

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.

How do I get purchase(s) from iOS in app purchases?

I want to get purchase or purchases made by the user even if purchased from other devices.
When an in-app purchase is purchased on one device, it is marked as a purchase by the user. So, a non-consumable purchase is available on all devices owned by the user after a single purchase.
If you create a consumable purchase and handle it using the login of your app, you should be able to do this. Of course, Apple's review process will check whether this is fair by the user.

How to get purchased product in iOS In App Purchase?

I am very new to In App Purchase. My app is having 50 Audiobooks. Which can be purchased through In App Purchase. I have two questions
If user is purchasing one book from shop. I can add it to library but if user quits the app and open again how could I know the last purchased product? Is it ok to use NSUserdefault to store the purchased book ID? (Note: My app don't have user registration)
I have restore option in my app, On restore I am getting all the previously purchased product id (I have created the IN-App purchase ID as book ID). I am getting that ID send the ID to backend and getting the book details and showing it in app is it the right way?
My app got rejected twice this is the third time, So also kindly share some of the reasons apple rejects In-App purchase if possible.
Thanks in advance

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