You can find detailed instructions on how to prevent accidental/unauthorized in-app purchases here: https://support.apple.com/en-us/HT20439.
To avoid accidental purchases in the Google Play Store, please follow these steps:
- Access the Google Play Store.
- Enter the “Settings” menu.
- Look for “User Controls” and activate “Use password to restrict purchases”.
- Enter your password and tap confirm when finished.
- Any subsequent in-game purchase after changing your settings will require your security password.