Apple's official support articles present multiple statements* about situations requiring the presence of a payment method at times, even for free items. You do not always have to have one, but if you are encountering one of those situations then you have no option but to enter a valid payment method if you wish to continue your purchase. The payment method may not be charged if you also have account balance or the item is free, but the payment method has to be present. You might even be able to remove it again immediately once Apple has seen it.
This next article lists valid payment methods for different countries but note that in this situation Apple Account balance alone apparently may not meet the requirement and you need to use another payment method until you find one that satisfies Apple's requirement (often a credit or debit card): Payment methods that you can use with your Apple Account - Apple Support .
If you have already entered a payment method, use the “Add a payment method” link above to check it. If a message appears in red there is a problem with it. If the information is still correct and current, contact your financial institution. Also check this resource --> If your payment method is declined in the App Store or iTunes Store - Apple Support
* Ref.:
Add a payment method to your Apple Account - Apple Support
"To make purchases from the App Store and use subscriptions like iCloud+ and Apple Music, you need at least one payment method on file."
If you can’t download or update apps on your iPhone or iPad - Apple Support
- "You might need to have a payment method on file, even if the app that you want to download is free."
Remove a payment method from your Apple Account - Apple Support
- If you have any active subscriptions, you must have at least one payment method on file other than Apple ID credit.
- You might not be able to remove a payment method if you have a balance due.
Sign in to your Apple Account - Apple Support
- "When you sign in to the App Store and other media services for the first time, you might need to add a credit card or other payment information."
How apps, content, and subscriptions from Apple are billed - Apple Support
- You can’t charge gifts to your Apple ID balance. If you send a gift or gift card, your primary payment method is charged.
- Some subscriptions might not be charged to your Apple ID balance.
What you can buy with your Apple Gift Card or Apple Account balance - Apple Support
"Some purchases might require that you have a credit card on file, even if you use your Apple Account balance to make the purchase."