You came to the right place for help with QuickBooks. I'd be happy to help you correct these unapplied payments in QuickBooks Online.
In order to correct your P&L, you'll need to create an invoice, create a journal entry for the payment, and apply the journal entry to the invoice.
To create an invoice:
Create a journal entry:
If you're uncertain what accounts to credit and debit when creating a transaction, it would be best to consult your accountant for guidance.
Apply the journal entry to the invoice:
You may find these articles helpful:
Let me know how it goes, I'll be here if you need anything else. Have a good one.