You can use Screen Time to prevent unintentional or unauthorised purchases from the App Store and other Apple services. You also can require a password for purchases, prevent certain types of purchases or turn off purchasing completely.
To prevent in-app purchases, you need to turn on Screen Time first. Find out how to turn on and use Screen Time.
When Screen Time is enabled, go to Settings > Screen Time, tap Content & Privacy Restrictions. If asked, enter your passcode, then turn on Content & Privacy Restrictions. You'll only be asked to enter a passcode if you’ve already created one in Screen Time. Find out how to create a Screen Time passcode.

Tap iTunes & App Store Purchases.
Tap In-app Purchases and select Don't Allow.*

* From here, you can also require a password for future purchases from iTunes, Books or the App Store.
If children in your Family Sharing group have their own devices, use Ask to Buy to screen and approve their purchase requests.
If you let children use your device, you can make a password a requirement for every purchase.
Tell us more about what’s happening and we’ll suggest what you can do next.