Hi there,
I get how confusing that must feel, especially since you and your friend are in the same country.
This usually happens when the gift code was bought through a store or payment method registered in a different region than your Microsoft or Minecraft account.
Even small differences in account settings, like region or store location, can cause the code to be locked to that area.
To fix this, check your Microsoft account’s region settings at account.microsoft.com/profile and make sure it matches your actual country.
Ask your friend to double-check their Microsoft Store region too. If both match and it still won’t redeem, reach out to Mojang or Microsoft Support with the gift code and proof of purchase, they can reissue it for your correct region.
Just to confirm, did your friend buy the code directly from the Microsoft Store, or through a third-party site like Shopee or Amazon?
That’ll help me guide you on the next step.
Regards, Aron