Check if app is reinstalled without storing unique id - flutter

When my app is first installed, the user gets 5 free consumables. After the consumables are finished, the user then has the option to get purchase 5 additional consumables. Is there a way to check if the app was previously installed. I don't want the user to uninstall and reinstall to get 5 free consumables again.
The plugin I'm using, in_app_purchase, allows retrieval of past consumables, so I thought I could have the user purchase a free consumable on startup, which I could later retrieve if the app is installed, but I don't want the user to go through any extra steps to use the app for the first time.
I would prefer a solution that doesn't require storing a unique id because that would require backend code and getting a unique id isn't possible on iOS.

Related

Non-Consumable using with free trial, how to know if user delete the App and install meantime ree trial not finish

My app is Non-Consumable with 14 days free trial, the main issue is what if user after 7 days delete the app and install again, so in this case the free trial start from 0 isn't it without having server? or Apple provide API that gives the count of free trial?
You have 2 options:
Store this information on your server side. This is how most of the apps do it. It requires that your app has some sort of authentication for the user. In this case you could, for example, let the user log in, and as part of login response, you'd send back the number of days left until trial completion.
Save this information into keychain, since the keychain survives the uninstallation. Keychain was not created for this use case, but nothing says you couldn't use it this way. Check this tutorial for example on how to use keychain.

IOS buy, erase phone, detect previously purchased

I got most of IAP purchase working, using user defaults etc
But supposing a user buys an app, then erases or updates to a new phone.
Then reinstalls the app.
How do I detect that the user has previously purchased the app?
That is what restore functionality is for. See the Restore section of:
https://developer.apple.com/documentation/storekit/in-app_purchase/offering_completing_and_restoring_in-app_purchases
There are three ways:
If you store some purchase indicator in the app keychain, it will be present when the app is re-installed. If you are doing subscriptions also include an expiration date you can check if a subscription is possibly out of date.
If you send the app receipt up to Apple, it will always give you back the most current purchase data - which includes any prior purchases. So on first launch, always send the receipt up to Apple to see if you might want to automatically restore a purchase made previously. Note that sometimes an application receipt will not be present immediately after install (although it should always be there), which is why you also need to allow for option 3.
There is also a SKPaymentQueue’s restoreCompletedTransactions() call you can make to basically replay previous purchase transactions. This is something you should wire to a button somewhere in your UI - Apple requires that. It's not something you want to automatically call as it can prompt for the user to enter their iTunes account password, so you should not rely on this method to restore purchases automatically, but it is good to have in place as a backup for the user.

Replacing several app into one in app store

My customer previously distributed commercial Apps A, B, C, D into app store sometime ago which several has bought installed. Now they changed their mind and decided to create one container App 'X' in which A,B,C and D are included and now as in-app purchase items. In future through this app they will add more apps like 'E','F' etc.
Assuming Apple approves this container app, i would like to understand how below scenario will work.
I can 'Remove' A,B,C and D 'from sale' so that it no longer shows in app store.
Per apple a non-consumable purchased item should be there to download any number of times under the account in which it was purchased
If i am an user who already purchased A,B,C and D and now also purchasing 'X', and if i delete A,B will it be available again to download even if it is not currently available in app store (due to my 'Remove from sale')?
Whether Re-releasing as container app is recommended or not, that is what customer is ordering us to do.
I would like to know how above scenario will work. Any idea?
If i am an user who already purchased A,B,C and D and now also purchasing 'X', and if i delete A,B will it be available again to download even if it is not currently available in app store (due to my 'Remove from sale')?
Ans : No it will not be available for further download.
For iCloud Stuff, iCloud manage only your account purchase info. Actual downloading is done from Apple Store only.
Your purchased content is automatically downloaded from the iTunes Store, App Store, or iBookstore based on iTunes in the Cloud availability by country.
Refer this iCloud: Restore your iOS device from iCloud
I dont recommend to release container app because user who had already purchased the app they again have to spent money to unlock the In-App which is not good. But if your customers are fine with that then your choice.
One Suggestion, Instead of re-releasing the container application you can assign URL Schema for each application so that user can go other application directly from one application if it fines with you.

Removing autorenewable subscriptions from iPhone App

I have an iPhone app that also features autorenewable products as an in-app purchase. The products are subscriptions to our service for up to 1 year in the future. We wanted to remove the whole in-app-purchase and autorenewable product from our app in the next version.
To accomplish this, we removed the signup option inside our app, so no new user should be able to sign up. Now we would like to disable the automatic renewal for all existing users.
How can I accomplish this? Is it sufficient to remove the in-app-products for our app inside iTunes Connect? Do the users get notified about this?
According to Apple (see WWDC 2011 Session 510, In App Purchases for iOS and OS X, at the 48:55 mark), the only things you can do as a developer to prevent subscriptions from auto-renewing are:
Raise the price.
Remove the auto-renewing IAP product from iTunes connect.
In both cases, notification emails are sent to subscribers, though not immediately. The talk says Apple checks 10 days before a (yearly) subscription renewal and sends email at that time. It's not documented anywhere, though, so I'd treat that as an implementation detail.
I've done the latter (removing the product) several times with my own (monthly) apps, and it seems to work as advertised.
One important note: if your app is a Newsstand app, it must have at least one auto-renewing subscription available. If you remove the last one, the app will be removed form the App Store. Users who have already purchased it will still be able to use it, and will be able to download copies from the "previously purchased" section of the app store, but no new copies will show up for purchase in the App Store proper.
It will depend on how you've implemented your system. Do you check receipts (and provide data/service) from your own server, or do it all within the app directly with Apple's servers?
In iTunes Connect you can remove a product from sale, effective immediately or at a future date. I suspect that's enough to stop a renewing subscription. (Remember you can test this with shortened timescales in the Sandbox.) But if not:
If you use your own server to validate receipts, go and give it an incorrect shared secret so that the verification step fails. That means the subscription validity will return as false (although for the 'wrong' reason) so your customers won't be able to renew.
If you do it within the app, generate a new shared secret so the one within your existing structures is incorrect. Then, as above.
If you can, I suggest sending a notification to your current users notifying them of the change, suggesting that they change, and letting them know it will 'fail' in the future but that's ok.

testing an in app purchase?

i developed a application with in app purchases..when user buys the subscription it gets stored on my server..after testing it few times i deleted the data from server to test it again but when i buy it the sandbox environment says u
you already purchased this.TAP OK to download it again for free
also i have used this test account on my previous application?? does it means i will have to create a new test account for this application?? also by mistake i used this account on apple store..i read somewhere that doing this will make your test account invalid...is it true?? should i create a new account for it??
For first question -
Since you are using the non-consumable model "you already purchased this.TAP OK to download it again for free" This is the valid behavior... StoreKit maintains the information whether you have purchased the app already or not. If you purchased already you can download data for free.
In your code, you need to check whether the data is present in the server, if it is present then don't download else download it.
InAppPurchase products are tied with the application... If there are two applications like HDversion and liteVersion... You need to create different ProductID's for inAppPurchase.