Check If User Has Purchased Previous App Version - ios

I am moving my iOS app from paid to free and need to know, after the user has installed the update, whether they have purchased the original app.
This way I can reward the user for their previous purchase.

This wasn't possible (easily) before iOS 7 but now it can be down by downloading and parsing the App Store receipt. This is (frustratingly) a lot harder than it sounds. You might want to consider using an Open Source project like RMStore.
I wrote a blog about my experience.

Related

How / When is IAP information added to iOS app receipts?

Short Version:
My freemium iOS app sends the app receipt to my server for validation and to check wether a users is eligible for subscription introductory offers. I noticed that there are a lot of receipts with no IAPs inside. This would mean that many users have been using the free trial version for years, which is quite unlikely.
So when is IAP informatioin added to the receipts?
Long Version:
My app has been offered in the iOS App Store for several years using a Freemium Model: User can download the app for free and test it for an unlimited time with limited features. A non-consumable in-app purchase can than be uses to remove these feature limits.
In theory users can use the app indefinitely without any purchase just using the test feature set. However, the due to the limitations this is highly unlikely.
Recently I have updated the app to offer subscription. To check if users are eligible for introductory offers the app receipt is send to my server for validation.
I noticed that there are a lot of receipts with no IAPs inside. Even for receipts with original_app_versions which are several years old. This would mean that many users have been using the free trial version for years, which is quite unlikely (due to the very limited feature set).
So when is IAP informatioin added to the receipts?
The new app version send the receipt to my server on the first start. There are three possible cases:
The app was never used before and this is the first installation of the app ever.
original_app_version == current version
Of course on the first start there are no IAPs, so nothing unusual in this
This an updated of an earlier version which was installed before
original_app_version < current version
The app / App Store hat plenty of time to include possible IAPs in the receipt
An earlier version of the app was used but than uninstalled. Now the current version has been re-installed
original_app_version < current version
Since has just been installed it might be possible that the IAPs are not included in the receipt yet?case.
So, only the 2. and 3. case interesting here. Why should previous non-consumable IAPs be stored in the 2. case since the app has been installed and running for a long time?
On the other hand it quite unlikely that thousands of previous users have now re-installed my app and thus resulted in case 3. Even if this really the case, is there anything the app can do to manually trigger the store to add previous IAPs to the receipts? Or does the user have to restore previous purchases first?
EDIT:
As far as I understand the Appel docs it does not really matter what information is stored in the receipt which can be found on the devices. When I upload this receipt to my server it acts like an token when being send to Apple for validation.
Apple than responds with the latest receipt information available (if the receipt/token was valid) in clear text.
Thus it shouldn't really matter how long the app was installed on the device or wether it was a new install or a re-install: Apple provides the latest information available. Thus if there ever was an IAP it should be included in the returned information. Right?
But this would mean that there are thousands of users which have been using a very, very, very limited trial version over years which seems very, very, very unlikely...
Is there any other explanation?

iOS Switching from paid to free app, how does one know who previously purchased the app?

I have a paid app that was released on iOS 4. It hasn't been updated and I'm now reworking it to work with iOS 10. Since in app purchasing was not a thing, I made a free (lite) and paid version of the app. I would like to update the paid version to iOS 10 and change it from paid to free with ads and an in app purchase to remove ads.
I tried researching various methods and I have not found a fool proof way or evidence that one will work in all cases. The two most prevelant methods I found:
Use an existing UserDefaults key value to determine if they opened the old app and then grant them no ads in the new version.
I don't think this method will work, as if the app was uninstalled or the user redownloads it after the update they would not have that value.
I believe iOS 7 offered receipt checking. Use receipt checking to determine if the user has paid for the app and check if the date is before the new version date.
I'm not sure if this would work either. I saw in the documentation to verify locally. Would everything I need exist if the app was an iOS 4 app originally? Would this work for users who had the app through a promo code? What if they don't have an internet connection at the time they open the app? I had trouble finding sample code for this option to test.
How would I go about doing this? Are any of the methods above the only way or are there others?
Out of all the resources I found on this subject, checking the receipt seems to be your only feasible choice. If you have an account where you purchased your app, you can run the new version of the app via Xcode with that account and see if the receipt validation gives you the expected information. Though installing the app via Xcode may alter the receipt that the account has, you may want to check on that.
NSUserDefaults option could work if you were setting any value to NSUserDefaults on the iOS 4 version.

Implementing Upgrade Feature in iPhone App

I already have an app in the app store which is a paid app. Now, I want to make the app free but put an option for NEW users to upgrade for the price. The old users can continue using all the new features of the app since they have already paid. My problem is that how will I track and distinguish new vs old users.
I think my answer is Receipt Validation in iOS 7 but it looks super complicated to implement. Any recommendations?
UPDATE: WRONG SOLUTION! DON'T DO THIS
One solution that has been floating around on the web is to save the version in NSUserDefaults. While that would work but what happens if the user deletes the app and reinstall it again. NSUserDefaults will be gone and then we are going to force the user to buy the app again or upgrade it again.

Know whether user downloaded iOS app for free or paid?

I am switching my iOS app which is already on the app store from paid to free. I want to know which users have paid for the app, so I can treat them differently (like not showing them additional ads). As far as I know, there's no way to get which version of the app users originally downloaded.
One thing I thought of is this. I can release an update at the same time the app goes free. Everyone who launches the game for the first time who has the update gets marked with a "Free Download" flag. The issue here is what if someone paid for the app, then didn't launch it, then updated their app. That means I will treat them like a free user even though they have paid. Thanks!
There's no way to do this with 100% accuracy without releasing a new app.
If you do use a flag of some sort, save the flag in the keychain and/or iCloud so that it will have a better chance of persisting across uninstall/reinstalls and from device to device (if you use iCloud).
Your best bet though is probably to release a new lite version of the app. It can be a pain to maintain two versions, but at least you know for sure who's paid and who hasn't.
I somewhat accomplish this with a server-side script. On initial app launch, I grab data from my server to determine if this is a paid or free install and then save this info in iCloud. It works relatively well, but it does have a drawback; a small percentage of the time the query fails. If it fails, I just set the app as being paid so as not to screw anyone over. This screws me over a bit, but I take the hit for the convenience of not having to update whenever I want to switch paid/free.
You cannot show updates or advertisement for the customers separately who bought the app for free or by paying money. Whenever you changed your paid app to free, the customers can download the application for free now.

iOS Development: Updating Free App After Buying

Ok, i don't know how call it but here i'll try to explain it...
I am developing an app and i am almost finished with it, and what i wanted to do is, first upload it as a free app for preview where the user has limited usage of it (like some features are blocked), it has ads that says to buy the full version and when the user bought the full version, it will automatically updates and unlock the other features.
The first thing that comes to my mind is to have 2 different apps the one for free and the other one is the full version and both upload it on the app store, but i saw some application that automatically updates their version after buying the full version.
How will i able to that?
Three words: In. App. Purchases.
StoreKit Framework Reference: http://developer.apple.com/library/mac/documentation/StoreKit/Reference/StoreKit_Collection/_index.html
Full Tutorial: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/
Have fun
You should set up an in app purchase:
http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

Resources