1
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Absolutely request the relevant data from the store. It's really easy to get a list of all purchases. Some stores even send this data to you when you initialize the store api. \$\endgroup\$ – Draco18s Jul 4 '18 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.