Depends on the location. In the EU, it would be illegal to charge someone more for using a credit or debit card:
> You're not allowed to charge your customers extra for using a credit or debit card. This applies to all card purchases (in shops and online) made throughout the EU.
https://europa.eu/youreurope/business/finance-funding/making...
Guessing there are no such laws in the US? Or maybe nowhere else? Not sure.