2

I know that they are possible since I implemented consumable purchases and they work but:

If I upload a new version of the app or re install it the consumable purchases are gone. Does not matter if for iOS or android. I used the device ID but that is not reliable and does indeed change in some scenarios

I would like to offer inapp purchases (consumable) and keep track how many a user has. Ideally over multiple devices but for sure for multiple installations (meaning they keep them after updates or reinstalls)

Is this even possible without some kind of login? Is it possible to implement subscriptions without this problem? I use revenuecat if that matters but asking more generally

dummiethon
  • 53
  • 1
  • 5
  • Data stored locally will not be lost during an update, only if the app is uninstalled and reinstalled. To keep purchases across reinstalls or across multiple devices you really need the user to register. Auto renewing subscriptions aren't a problem since the user can simply restore their purchase – Paulw11 Aug 01 '22 at 13:37
  • @Paulw11 Ahh okay. Dont know if that requires a too detailed answer but why are auto renewing subscriptions not a problem? Did not look into that as I only implemented consumable ones but the setup looks very similiar. Didnt see anything to identify users and keep track of subscriptions But basically if I dont force the user to create some sort of account and everything is "anonymous" I could still implement subscriptions? How does the identification work there? – dummiethon Aug 01 '22 at 13:50
  • Because for non consumable purchases and auto renewing subscriptions (on ios anyway, I don't know about Android) you can simply call [`restoreCompletedTransactions`](https://developer.apple.com/documentation/storekit/skpaymentqueue/1506123-restorecompletedtransactions) and the purchase transactions will be presented to your transaction observer. – Paulw11 Aug 01 '22 at 14:01

2 Answers2

0

In case of consumable in app purchase it is definitely lost and cannot be recovered across devices without saving them for the relevant user. You may have to create your own saving and recovery system if you wish to make it available across devices.. maybe you can take a look at non consumable products or subscription

Kaushik Chandru
  • 15,510
  • 2
  • 12
  • 30
  • I will look into other forms of purchases but do you mind explaining why they are possible without some sort of registration system? Dont I have to keep track of one-time purchases or subscriptions as well for individual users? Like new installations or new devices. How do I know if it is the same user? I see the same issue as with consumables? But again did not read into them yet – dummiethon Aug 01 '22 at 14:00
  • In case of subscription you can restore them and you get a transaction date for reference. So you can still set the end date of the purchase. For non consumable products like for example lifetime subscription the user will restore with their google or apple id and you can manage how the app should perform after iap restore – Kaushik Chandru Aug 01 '22 at 14:04
0

Good afternoon

Theoreticaly Possibly, but there are several ways that you need to use all together in order for everything to work correctly. For example - It is necessary to store the user_id in the keyChain, then the saved id will not change when reinstalling (this only applies to iOS). It is also necessary to get information from the Receipt for different users (with different devices) but having one check and merge them. Therefore, it is desirable to have 2 ids for the user user_id and device_id. You need to receive and process webhooks from Apple/Google to understand the current status of a particular product. Doing this on the client is not the most pleasant experience. Some of this is generally impossible to do only on the client side. Better use the ready-made solution Apphud, RC ... If you have a free time and a team of backend developers, then you can implement all this yourself.

Look at the internal implementation of the services above (the code is open) how they work with Receipts and ids. You will understand that without the usage of unique identifiers you will encounter a lot of problem cases.

Joe Hallenbeck
  • 1,452
  • 12
  • 24