If you've entered a payment for more than the amount due on an invoice, a portion of the payment equal to the amount due is allocated to the invoice and the remaining amount is available to be allocated to future invoices or refunded.
If a customer has any unallocated payments, you will see a line displayed on their invoices below the Totals section. This line will indicate that the client has unallocated credits or payments available and includes a link that you can click to apply them to the invoice.
Click the link to apply the credit to the invoice and complete the form for allocating credit to the invoice.
You can read more about allocating credit to an invoice here: Allocating Credit or Unallocated Payments to an Invoice.