In most cases all purchases will first come from your Apple Account and will only charge your card if there are not enough funds to cover the purchase. As seen in the Support Article, there are some subscriptions by Apple that must be started with the card on file, but the recurring charges will first come from the Apple Account.
- For some recurring charges, like AppleCare+, you can't start your subscription with Apple Account balance. But as long as you keep another valid payment method on file and your Apple Account balance would cover an entire charge, your recurring charge will be pulled from your Apple Account balance.
What you can buy with your Apple Gift Card or Apple Account balance - Apple Support
The order of billing for in-app purchases is shown here:
How apps, content, and subscriptions from Apple are billed - Apple Support
If the card on file is no longer a valid payment method due to a charge that failed to be processed, then you may not be able to use any in-app purchases until that problem is resolved. That would require adding a valid payment method first. You can contact Apple directly for further assistance here.
Contact Apple Support - Apple Support