Customer pays in advance

If a customer pays in advance, and then I invoice them and credit that against the amount they have paid already, is there a customer ledger that allows me to see all payments received in advance, invoices sent, credits against their account, and outstanding balance if any?

And how do I receive in a customer’s payment, without having raised an invoice yet? And when they pay, I need to apply that invoice to what has been received? And then need to print out the customer ledger.

Allocate the advance payments to customer credit account for that customer. As you invoice the credit will be allocated to the last invoice.