If a digital gift card has not been redeemed, you can cancel it and get a refund up to 14 days from the date you bought it.
Sign in to the gift card history page in your Microsoft account. If you end up on a gift card merchandise page, select Gift card history, sign in, then select Gift card history again.
Locate the gift card to cancel.
Select Cancel > Confirm to cancel the order and get a refund.