It’s usually possible to pay for a gift card with a credit card—but not all of the time.
When you try to buy a gift card this way, there are two companies that have to be okay with it:
The retailer selling the gift card
Your credit card issuer
Most of the time, both companies will allow it, but some do place restrictions on this type of transaction.