Gift cards get redeemed for balance with Apple. This article broadly outlines what one can buy with Apple Account [Apple ID] balance --> What you can buy with your Apple Gift Card or Apple Account balance - Apple Support
• In countries and regions where Apple Gift Card is available, you can use your Apple Gift Card or Apple Account balance to buy products and accessories at apple.com, an Apple Store, or in the Apple Store app. In these countries and regions, your Apple Account balance includes the balance from any Apple Gift Cards or App Store & iTunes Gift Cards that you have redeemed.
• Buy apps, games, or in-app purchases from the App Store.
• Buy music, movies, and more from the iTunes Store, Apple TV app, or Apple Books.
• Pay for subscriptions like Apple Music, Apple Arcade, and Apple TV. Or pay for subscriptions to apps from the App Store.
• Pay for iCloud+, Apple's premium cloud subscription.
Basically Apple Account balance can only be used to buy products sold by Apple which does not include medicines.