You entered the code incorrectly.
Check if you entered the code correctly to exclude any typo's. Check if the region of your account is equal to the region of the code. Try it again at Xbox.com, or with your console. If it still doesn't work, contact Support.
Xbox codes can be checked at www.xbox.com. Login with your account, click on your gamertag and go to 'Redeem code'. Copy and paste the delivered Xbox code and redeem it.
You or someone else already used this code.
Restart your console and re-login with your Xbox account, if the subscription or the Xbox credits are not activated in your account - contact Microsoft.
Go to Xbox.com and login with your Xbox account. Click on your Gamertag and go to Microsoft account. Here you can see how many credits are available on your Xbox account. If there are no visible credits, then you might redeemed the code with another account. Contact Microsoft to find out which account was used for redeeming the code.
The region settings of the Xbox account are different than the region of the Xbox code.
Make sure that you are using an account with the same region settings as the region of the code.
You can check and change the region settings via; 'Change your billing address' in your Xbox account; https://commerce.microsoft.com/PaymentHub/Profile?ref=xboxsettings
If you are still experiencing problems after following the above steps? Then please contact Support.