As the sender, you can return the gifted item for a refund. The recipient can’t return or exchange the gift code. Check your order history to request a refund.
https://account.microsoft.com/billing/orders/
Refunds for unredeemed codes must be requested within 90 days of making the purchase. If the code has been redeemed, we’re unable to process a refund, even if it’s within 90 days of purchase. For more info, visit:
https://www.microsoft.com/store/b/giftterms?rtc=1
It might take a few hours for new purchases to appear on your list. If you don't have the order number, wait a few hours and then check back again.