On iOS devices:
- Go to Settings -> General -> Restrictions.
- Tap Enable Restrictions.
- Create a password that you will remember for Restrictions and then confirm it. It is recommended that you choose a password different from the one you use to unlock your device.
- After tapping Enable Restrictions, you will see a list of items authorized on your device. Disable In-App Purchases to restrict them.
If you do not wish to disable purchases entirely, you can change your settings to request a password before completing in-app purchases. To change your settings, go to Settings -> App Store, iTunes Store -> Password Settings.
You can find more detailed information about ways to prevent accidental purchases on this Apple Support page.