You can find detailed instructions on how to prevent accidental/unauthorized in-app purchases here:

iOS
Android