0
\$\begingroup\$

I use Player Prefs to store the user purchase information in Android and iOS, but I'm not sure it's safe enough. What is the right or better way to store user purchase information?

public void OnPurchaseComplete(Product product)
    {
        if (product.definition.id == purchaseid)
        {
            PlayerPrefs.SetInt("iap", 1);
        }
    }
\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

No, PlayerPrefs are not safe, because it's well-documented where Unity stores them and with that knowledge it's trivial for any player who has a basic technical understanding of their operating system to edit that information.

But any form of data storage on the user's device is unsafe. If your game can read and write that information, then so can any other program. Encryption won't help either, because in order to encrypt and decrypt the information, your game needs to contain both the algorithm and the key, which a determined hacker can find, extract and put into their own cheating tool.

The only real solution is to store this data server-sided. Either on a server you control, or by using the purchase verification functionality of the platform you use for IAP.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .