You have to redeem your card into your account. Once the balance is in the account, when you purchase something (from the same Apple ID/iTunes account), the cost will be deducted from that balance.
Redeem iTunes or Apple Music Gift Cards and content codes - Apple Support