how can I automatically add a credit card processing charge to a SO or invoice

Many businesses are adding a Credit Card Processing charge (1 to3 %) to transactions paid by credit card.  This is justified by the need to cover the credit card processing fees, which have become significant.  Can I automate that addition to the transaction?