As you found out Microsoft no longer sells 8/8.1.
Forget about buying Windows 8, as Microsoft ended support for 8 in Jan, 2016.
8.1 is supported by Microsoft until 2023.
But no one can guarantee that you will buy a legit licence for 8.1 from anywhere.
It comes down to buyer beware.
And if it is too cheap, forget it.
You could look at Amazon.com, etc.
@@@@@@@@@@@@@@@@@@@@@@@
Warning:
You do not buy a Product Key by itself, as they are normally stolen/pirated, Volume Licenses which are not for private use, or MSDN keys which are not to be sold by the original subscription holder.
Make sure that you buy the complete sealed package (DVD, license)
https://www.microsoft.com/en-us/howtotell/Shop.aspx
Read Section: Beware of Product Keys sold separately.
Cheers.