Sunday, May 8, 2016

unity - Where to store in app purchase data?


I'm making a game using unity. In the game I've a purchasable product "remove ads". Where should I store user purchase data? If I use player prefs data will restore after a reset or uninstall.



Answer



Player Prefs is fine, mostly. Consider, however, that it is fairly simple for a smart user to modify player prefs to remove ads on their own. You can instead rely on the in-app purchase system to track this for you.


In particular, on iOS, you can check the App Store Receipt (using classes in StoreKit, which only requires connecting to Apple to refresh the receipt once, if it’s not already downloaded), which includes information about all non-consumed in-app purchases. That is handled by Apple, and can be checked on each launch, and is pretty secure.


Similarly, when you initialize in-app billing on Google Play, you are given a list of products the user already owns that are not consumed.


Or you could just store it in player prefs. After a reset or uninstall that information goes away, but thats why apps usually have a "restore purchases" button which will get that information back from the app store/google play store.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...