How to 'fake' a restore in-app purchase for previous app users when moving from paid to free - ios

Our app is moving from paid to free, and in the process, moving a key functionality from being included to activating via In-App purchase. Obviously, we don't want current users who paid for the app functionality to be charged again in the In-App purchase for functionality they already had. So on the update by the user, we want to 1) identify current users and 2) make it so they don't see the In-App purchase in the first place, sort of 'faking' the In-App purchase so that the app will appear to them exactly as it did before.
The app does not have a backend, so we have to determine current users from new by examining the saved user data fields for certain values. I do understand that if a previous user has deleted the app from their device that nothing can be done, and I don't mind charging them for the In-App purchase, since they never used the app anyway.
But for those current users who update and assuming we can examine the saved user data and determine that they are current users, what would be a good way to bypass the In-App purchase and make the app look like they already got it, when in fact they never paid for it? Thanks!

Here's what I would do - keep in mind this will take some time:
Set up a server (I prefer EC2) with mySQL on it. Plenty of tutorials about this.
Submit an update to your app that sends the user's UUID to your server.
Wait. This is the hardest part. You'll need to wait until satisfactory majority has updated to your app. That majority percentage is up to you to figure out. It could take months for this to happen.
Make your new, free, app send the UUID to the server.
Check to see if the UUID is in the DB.
If it is, set whatever you would have set when an in-app purchase was made to true.

You have several options:
Free in-app purchase for a limited time:
You would create a free tier in-app purchase content and release an update that somehow makes the user sign up for it. This way, when your user switches devices they can restore the purchase and regain the functionality.
Wait for a period so most people use the in-app purchase content
Change the tiers and release your app as free
Dual versions
Make a demo version of your app. Note this can be rejected by Apple.
Create a file in the filesystem
Make a file in the filesystem and save into iCloud. The app will check for the file and thats how you would determine if the user has paid for the app (or should buy the in-app purchase).
iCloud will synchronise the file between user's devices and it will make sure that whatever device the user uses the app will see the user as 'paid'.
I hope this helps, currently having this problem myself.

Related

iOS: Tracking the paid users while converting paid iOS application to free with in-app purchases

We have a paid iOS application in the AppStore currently. We are planning to convert it to a free application with in-app purchases. We would want to make the in-app purchases free to the users who have already paid for the application in the previous version. I think this can be done via App Receipt Validation. But will the receipt get updated once the application is converted from paid to free and will the purchase details get lost?
If you convert your app from paid to free, you are still able to inspect the receipt and see which version was originally downloaded and act accordingly.
When we did this in one of our titles, we implemented a three tier system:
We bumped the version of the save file. Any time we promoted from a save file with version <= X (where X is the last one that was on the premium version) we would award the appropriate IAPs (in our case we gave them a coin doubler, an ad disabler and a chunk of coins). You should use this simple mechanism for the majority of the users because receipt checking can require an internet connection, and your users might not be online the first time they boot after an update.
We had a 'restore IAP' button. You need this anyway on iOS if you have any non-consumable IAPs, but we additionally added a check of the App Store receipt which lets you discover whether or not the user originally paid for the game. Here's the tutorial we based our code on, we chose the easy way, but you might need to weigh that up against piracy concerns.
Our reimbursement system also checks a file that we host, which can give out extra coins/doubler unlocks/ad removers. If the receipt checking failed (we supported pre-iOS 7 so we couldn't rely on receipt checking APIs) then we could reimburse users that way if they contacted us. This is a good idea anyway, with luck you'll have a lot more users after you go free, which means more people who will discover some progress-losing bug in your app - it's good to be able to give them stuff in return.
Edit: I'd also recommend keeping track of the user's category in the save file. So, you might have 'free' users who have never paid anything, 'paid' users who downloaded for free but have bought some IAPs, 'premium' users who bought your app when it was paid, and 'premium+' users who bought your app when it was paid AND have since bought IAPs. Even if you don't need this info immediately, it's worth tracking for analytics and so that you can reward your old premium customers with free content in the future if you decide to do so.

Can Apple tell me what purchases a user has?

I'm aware of the restore functionality and have implemented it in my apps before, but still has holes in it.
I'm trying to display customized screens based on what apps the user have. Without user interaction, I want to be able to ask apple to retrieve me the in-app purchases that belong to that user for this app?
Other posts mention that I should always keep track of that via calling methods like:
NSUserDefaults.StandardUserDefaults.BoolForKey
But at the same time considers it insecure.
I am currently storing the info in DB. That's easy, but consider the following scenario:
User downloads the app. My DB records that user has 0 in-app purchases. The user later purchases 1 in-app purchase. My DB records that too.
User deletes the app for whatever reason
After a while, he re-downloads the app. My DB at this point starts a fresh and records that the user 0 purchases.
the user sees the in-app purchase (he already bought) and clicks on purchase again.
Here, my execution flow stops and apple picks up... Apple alerts the user that he has already bought the in-app and offers to get it for free.
That message is for the benefit for the user only, and my app is unaware of that. I haven't been able to find a call to apple asking what purchases a user had made for my app? I too, wouldn't want the user to pay again, but be able to always know what purchases he has made in the past at any given point. Why is that information so sealed at apple side? They alrady know the user has may app and I am only asking about in-app purchases in that app.
I am using Xamarin.
You need to refresh the receipt file and then scan through it. It will list all purchases the user has made inside that app, whatever device it was on. This code will let you parse the file and see the purchases made: https://github.com/rmaddy/VerifyStoreReceiptiOS
You could simply make your database store account information the user creates when they want to purchase something from your in-app extras. So in order to make that purchase they have to create a username and password for your app, thus giving you a way to keep track of who owns what in app content without having to ask apple.

iOS App Freemium to Paid App

I have Freemium apps in the AppStore. Originally it was Paid but I wanted to see if Freemium versions make any difference in Downloads and Sales. It did make difference - number of downloads increased by 10 times but number of purchases reduced by 2 times. So Freemium modal didn't work for me. I want to change back to Paid.
I do not want to create other versions of the Apps as I have really good reviews on all Apps which I don't want to miss. Can someone please help me if it is possible to convert my Apps to Paid and do not allow people to use full functionality who has already downloaded apps but haven't paid?
I will somehow need to detect they have been using old app and not paid. I can do it by releasing an update that store key in the Keychain but I don't understand hoe would those users be able to pay at all as Apple doesn't charge for the App as it is already downloaded in the past, and they won't be able to use full features as they downloaded freemium app....arghhhhh!!! Not sure if this is even possible but want to hear some of yours thought.
I believe paid upgrades are not possible, you will lose profit and you can't do anything about it unless you are willing to create a new app to replace the old one. The move from paid to fremium is a permanent one, you cannot force existing users to pay after the app is free.
It is possible to move back to Paid, without giving the previous Freemium users the full version.
To do this, you have to:
Know the last version of your app that was Paid
Check the user's purchase receipt (refresh receipt if necessary from Apple)
Know whether the user has made any in-app purchases during the Freemium period (e.g. every time the user upgraded, you added an 'Upgraded' item to their keychain)
Switch to Paid
If you have this information, you go ahead and switch your app back to Paid and:
Check whether they have made any in-app purchases (via e.g. their keychain 'Upgraded' flag). If they have, give them the functionality - easy. If they haven't then go to the next step.
Check the user receipt to see what version/date of the app they first downloaded. If it is during the Paid period, upgrade them to full version. If it is not, and the user has not made an in-app purchase, keep them at Freemium.
Disadvantages
There are 2 disadvantages I can see with this approach:
Any user that downloads the app after Freemium will need access to the Internet for you to confirm their receipt. This means the user might download the full version, then at a later time when they are not connected to the Internet, open the app only to find that they have to Upgrade. Of course once they connect to the Internet and their receipt is validated, they will be upgraded, but in the meantime you might get some bad reviews and angry customers.
Your app will now be a Paid app that has In-App purchases. This may confuse users thinking that if they buy your app, they will have to further upgrade via in-app purchases... and put them off.
Of course the advantage is that your Freemium users will stay freemium :)
I have done this myself, and had no problems with the process.

Merge paid app and free app with in app purchase

I have 2 application on appstore
Free app with in app purchase.
Paid app.
Now, I want to keep only one app on appstore from above options 1.Free app with in app purchase and remove the paid app. But here I want to give the app with full functionality to those user who used the paid app (Purchased the paid app).
Here my question is how can I merge these 2 app into single app which will be free and contains in app purchase by keeping the paid app user as it is ?
If anyone have any idea regarding this then please share.
Thanks in advance.
I solved my problem by using the icloud. First I provided the update to both the application by doing following changes.
I used "key value store" icloud option and stored some setting on icloud just need to make sure here "iCloud Key-Value Store" value in .entitlements file (which was automatically created by XCode) in both the application is same for both the application. The setting stored here is accessible to both application and depending on the setting I identified the user and gave access to specific functionality.
Under iOS7, you can use Receipt Validation. Receipt Validation offers you to see information about purchasing the app and in app purchases. If it returns date before you made the app free, that means that the user paid for the app.
This will work only under iOS7.
See Receipt Validation Programming Guide
I too am facing this issue with a couple of my apps. I'm still looking for a good solution, but I came up a less-than-ideal solution in the meantime. You can issue an update to your paid app that will connect to a database (on your web server) and insert a row with information about the purchase (AppleID, maybe some kind of digital receipt). Then in the free version with IAPs, the same database connection can be used to see if the owner of the free app already purchased the other app. Based off of that, you can unlock the IAPs. The only problem is that this is dependent on all previous customers updating to the latest version.
As mentioned, Receipt Validation would probably be more efficient, however this isn't backwards compatible. Good luck!
I'm assuming you're looking to merge the purchase history on Apple's servers; you can't merge the purchase data for two bundle IDs, you'll have to devise some way of having users persist their data on a server that you control. Update your app with a login and tie that login with the purchases as user has made.
The workflow would be something like this:
1) User logs in on paid app
2) User restores purchase history
3) Paid app saves restored purchase history to your server
4) User logs in on free app
5) Free app downloads all purchase data for the logged in user

Convert existing iOS paid app to freemium model with in-app purchase

I currently have a paid app in the store. Apple have not allowed a 'lite' version to be submitted as well, so I have no choice but to update the current paid version to a freemium (with in app purchase) model. I have the problem of not loosing functionality for v1 users that have purchased the app the first time round.
Is there any way to determine if an application have been updated from a previously installed version so I can unlock the paid parts of the app?
Two similar questions (from a few months ago):
Transition an existing paid for app to free version with In App Purchase
iPhone + upgrade existing paid application on app store to free application with In App purchase + what about the customers who have already purchased the paid application
There is now an Apple-approved way to do this on both iOS and macOS. The originally downloaded version of the app can be obtained from the receipt using the info key Original Purchased Version. You can then decide whether to unlock features if that version predates the switch to IAP.
For instance, once you have retrieved the receipt info:
NSArray *versionsSoldWithoutIAP = #[#"1.0", #"1.1", #"1.2", #"1.3"];
NSString *originalPurchasedVersion = [receiptInfoDict objectForKey:#"Original Purchased Version"];
for (NSString *version in versionsSoldWithoutIAP) {
if ([version isEqualToString:originalPurchasedVersion]) {
// user paid for the currently installed version
}
}
For more info see the WWDC 13 video Using Receipts to Protect Your Digital Sales. At 5:40 the presenter comments: "I think the most exciting thing that's in the receipt this year, especially for you guys if you have a paid app in the store is that we've included information in the receipt that's going to let you do a transition from being a paid app to being a free app with in-app purchases without leaving behind all the customers that have already paid for your app."
With iOS7, iOS app can verify app store receipt, which contains app download date.
By using this donwload date, you could determine if a customer is previously purchased or not
First, I just want to say I personally think the freemium model is great. It has worked out very well for many developers. People love to download free apps, and will do it on a whim, but pay much more attention to an app before spending $0.99 (Which is due to the effect of free - for more info on that, check out Dan Ariely's book Predictably Irrational)
For more info on freemium, google it - There have been tons of articles written about the success of it.
Ok, back to the actual question:
Theres a couple ways you can handle a situtation like this, although the unfortunate matter here is none of them are fool proof.
The best solution would probably be for your users to have accounts. Without knowing the specifics of your app, I can't say whether or not user accounts are appropiate for your app. User accounts stored on your server have many additional benefits, including user management, and tracking what purchases a user has made. This will allow users who delete the app, and then re-install it, or get a new device, to maintain their purchased content. Furher, whenever you use in-app purchase, you should validate the purchase on your own server (or with Apple), which a server based user manegment system can all do. If your totally in over your head with creating your own user management server, check out Parse. Its dead simple to create an amazing backend server (for basically free)
iCloud Key/Value type of system. I'm not very familiar with how this would work - so I'll move on.
Another, not nearly as fool proof solution (but much quicker/easier to implement) is to use NSUserDefaults. You can store an object when the user makes a purchase, or with the date a user installs your app. Then if you issue an update converting your app to freemium. Then in the new update, check which purchases the user has made or the date they installed it, and react accordingly. For info on how to do that with NSUserDefaults, check out my answer to another question on implementing that: NSUserDefaults and app versions.
But this solution does present the following pitfalls:
If the user deletes your app, the NSUserDefaults are lost forever
If the user didn't install the update setting up the NSUserDefault system, but then installed the update with the new freemium model, the app would treat them as if they hadn't purchased the content.
In summery, this is a difficult question, with not a lot of easy/perfect options.
Anyway,
Hope that helped!
I'm dealing with the same thing and came up with the following idea: Create the freemium version under a new name and app ID. Keep the existing paid app in the app store, but raise the price to something absurd and clearly state in the description that the app is there to maintain support for existing users and that new users should try the freemium version instead.
Existing paid users won't lose support for their existing app and can delete and install any time it without re-purchasing.
You won't have to keep updating the old paid app, either. Just keep it in the app store.
The downside is that existing paid users will not be able to migrate smoothly to the freemium version to get any extra features you add in the future without re-paying for what they already have.
Still trying to decide if this will work for me but it could be a good option for others. Comments appreciated.
I've been thinking about this problem for some time now. I have a substantial amount of customers that paid for my (in App Store terms) high-price niche-App and I'd hate having to tell them to re-purchase as I plan to migrate to an In-App Purchase model.
The idea I came up with (and I'll ask Apple support whether it's legal) is to phase out the current paid App but ship a last update for it that allows "unlocking" the In-App purchases of the new App based on the In-App model. I was thinking about a challenge response scheme:
User has installed paid App on his device
User installs new In-App App and opens it. The new App detects the paid version and offers to unlock the In-App purchases (on this device only of course and as long as the App isn't deleted)
The new App generates a nonce, signs it and calls the old App with it via an URL Scheme
The old App decrypts the nonce, adds +1 one to it and signs it again. Calls back to the new App via URL scheme
The new App validates the nonce and unlocks the features
The scheme can be easily implemented using a pre-shared key. It's of course a weakness on jail-broken devices, but then every App storing In-App receipts has those problems.
You can check the 'original_application_version' of the receipt. All iOS downloaded from the appStore have a receipt even if it is a free app.
TPInAppReceipt is a simple swift library that can help you with this.
import TPInAppReceipt
do {
/// Initialize receipt
let receipt = try InAppReceipt.localReceipt()
let originalAppVersion = receipt.originalAppVersion
let buildSoldWithoutIAP = 22
let originalAppVersionInt = Int(originalAppVersion) ?? 23
if originalAppVersionInt <= buildSoldWithoutIAP {
// unlock all features
UserDefaults.standard.set(true, forKey: "isPaid")
}
} catch {
print(error)
}
Note: The receipt.originalAppVersion returned is the build number as at the time the user first purchased the app from the appSore. Also, the receipt won't be available in the sandbox environment until you purchase or restore an inAppPurchase first.

Resources