In certain jurisdictions, it is illegal to charge extra base on the payment method. But it is not illegal to offer a discount. So, you can't charge 5% for a credit card transaction, but you can offer a 5% discount on a cash payment.