Yes! To create a predefined surcharge for Credit Card and/or Paypal payment types, start by creating an inventory item (which you could call “Credit Card Surcharge”). Click on Discount-Percent, and then in the Percent Discount field, enter the surcharge percentage amount as a negative number.
To apply the surcharge to an invoice, add the Credit Card Surcharge as a line item.
Then, go ahead and accept payment as usual, via the Payment Form.