I believe that's the very definition of legal tender:
https://en.wikipedia.org/wiki/Legal_tender
It doesn't prevent you from accepting other means of exchange (though in some countries it does), but it does force you to accept it, even if you don't like it.