I bought this cactus over two weeks ago. What is it's name and how should I take care of it?
It appears you are the proud and lucky owner of a type of barrel cactus. I may have something similar, and could try to find out what that genus is, if you are really particular about the name.
Care for these plants is generally easy. Water about once a week or so, lightly. Never water heavily or the roots could decay. Generally, adding a bit of compost is good, there are even fertilizers for them, but they rarely need much.
If you are repotting, either choose a soil meant for cacti, or based on your experience, make sure the top soil is rocky, allowing for good drainage - the roots don't go deep, and you want to make sure that water does not collect around the roots.
What else - plenty of sunlight, but not so much that it would burn. In my garden, during peak summer, there is shade at least part of the day and I find such spots for most sunny plants. They can be indoor or outdoor depending on your zone. I have cats, so I grow my plants outside in general, in zone 9b, and these do just fine. I watch for the pots after rain to make sure there is no standing water. I repot these about 2 - 3 years or so.
If there are any care specific things I have not covered, do let me know. Also, there is plenty of information online.