You can check if the in-app purchases are enabled on your device by opening your device's settings by following these steps:
Open the Settings app on your iPhone or iPad
Go to Screen Time Screen Time> Content & Privacy Restrictions > iTunes & App Store Purchases > In-app Purchases
Select "Allow"
For further information regarding this issue, please go through this Apple Guide.