There is an option to allow overpayment of invoices in company config.
Company Configuration-Detail Fields
Allow Invoices to be overpaid
Select to allow for over-allocation of cash against an invoice to leave it with a credit balance. The overpayment is left as a balance on the same chart of account (usually AR Chart of Account) as if it were an invoice. AR Apply Credit Memo and Write-off and Adjustment routines allow application or write-off of an invoice overpayment.