This is happening because the in-app purchases option are not allowed on your iPhone or iPad settings. But this can easily be fixed. Follow these simple steps now:
To enable this, all you have to do is:
1. Go to Settings > Screen Time.
2. Tap Content & Privacy Restrictions. If asked, enter your passcode, then turn on Content & Privacy.
3. Tap iTunes & App Store Purchases.
4. Tap In-app Purchases and set to Allow.
To prevent in-app purchases again, visit Apple’s official support