United States coins and currency (including Federal reserve notes and circulating notes of Federal reserve banks and national banks) are legal tender for all debts, public charges, taxes, and dues.
31 U.S. Code ยง 5103 - Legal tender
No federal mandate...state & local laws may vary:
https://www.federalreserve.gov/faqs/currency_12772.htm
https://www.patriotsoftware.com/blog/accounting/can-business-refuse-cash-is-it-legal/