To automatically add a fee when paying by credit card in Odoo version 16, you can use a custom module that adds a fee to the invoice when the payment method is a credit card. Here's an outline of the steps you can take:
Create a custom module: You can create a custom module in Odoo by going to Settings > Apps > Create, and filling out the necessary fields.
Define a new payment method: In the custom module, define a new payment method for credit card payments. You can do this by creating a new record in the "payment.acquirer" model, and setting the "provider" field to "authorize_net" (since you are using authorize.net for credit card processing). Set the "fees_active" field to True, and the "fees_amount" field to 3 (since you want to charge a 3% fee).
Override the "PaymentTransaction" model: Override the "PaymentTransaction" model in your custom module to add a fee to the invoice when the payment method is a credit card. You can do this by creating a new record in the "ir.model.fields" model, and setting the "name" field to "fee_amount". Then, override the "create" method of the "PaymentTransaction" model to add a fee to the invoice when the payment method is a credit card.
Update the invoice view: Update the invoice view in your custom module to display the fee amount on the invoice when the payment method is a credit card. You can do this by creating a new record in the "ir.ui.view" model, and setting the "inherit_id" field to "account.invoice_form". Then, add a new field to the view to display the fee amount.
Once you have completed these steps, your custom module will automatically add a 3% fee to the invoice when the payment method is a credit card, and display the fee amount on the invoice. Note that you will need to configure your authorize. net account to charge the fee separately from the invoice amount.