Sometimes you need to make sure the people using your iPhone aren't running up the App Store bill. The option to switch off in-app purchases altogether is handy, especially if young children regularly use your iOS device. To lock in-app purchasing follow these steps:
In iOS 11 or earlier
1. Navigate to Settings -> General -> Restrictions -> Enable Restrictions
2. Enter a passcode for Restrictions. You will be asked to enter it twice.
3. Scroll down to the Allowed Content section.
4. Select In-App Purchases -> OFF.