I'll add this to the suggestion list, but there are several problems with this.
The first is that the transaction total is calculated before the payment window. So unless you knew up front that the customer was going to pay by credit card and indicated as such before you got to the payment window, which would result in the automatic entry of the amount in the payment field to be the total of the transaction without the surcharge.
The second is split payments. If they pay a portion with a credit card and a portion with another payment method, applying the surcharge to the total amount would cause you to add too much of a surcharge. And since you can't know the split for credit cards before they are processed.
The third is that EMV changes everything. With EMV card present processing, the customer can potentially choose (and/or change) the payment type from the terminal. So you may start a charge as a debit and the customer selects to process it as a credit, or you start it as a credit and the customer selects debit. So you could end up charging a customer a surcharge when they shouldn't get one, or not charging when they should.