This error means your Apple ID isn't allowed to make purchases.
If you belong to a Family Sharing group or have Parental Control restrictions enabled, check that Ask to Buy is not turned on for your account.
You can check this by going into your device's Settings > Screen Time > Content & Privacy Restrictions > iTunes & App Store Purchases.
This is where you can find how your device or Family Sharing account is limited regarding purchases. You'll need to edit these restrictions (or have your parent or account owner do it) to be able to make in-app purchases.
