When receiving a payment, it is considered a best practice to always match the payment up with the corresponding open invoice. That said, from time to time, you may notice an unapplied payment sitting on a customer's account. To link the unapplied payment to an open invoice, open the payment in QuickBooks and apply it to the open invoice.
(1) Open the unapplied payment in QuickBooks
(2) Select the applicable invoice(s) from the Outstanding Transactions list
Additional Info
If credit memos are automatically being applied to open invoices and you would rather issue a refund (or vice versa), refer to this QuickBooks Online help article for steps to edit your settings.