"There is no federal statute mandating that a private business, a person, or an organization must accept currency or coins as payment for goods or services. Private businesses are free to develop their own policies on whether to accept cash unless there is a state law that says otherwise."
https://www.federalreserve.gov/faqs/currency_12772.htm
It may be illegal to refuse cash as payment for an existing debt but businesses are free to choose how (and with whom) they conduct business, including which forms of payment they accept.