An Apple gift card only works on an Apple Account from the same country. How to check yours.
Apple gift cards are tied to a country. A US card works only on a US Apple Account, a UK card only on a UK account, and so on. If the countries do not match, the card is refused.
Open the App Store, tap your photo, then Redeem Gift Card or Code. You can type the code or scan the card. The balance pays for apps, games, iCloud+ and other Apple services.
Changing your Apple Account country is possible, but you must spend your balance and cancel subscriptions first. It is easier to buy the card for your current country.