You can either link the deposit when receiving an invoice payment or delete and create a payment, depending on how you make the deposit. Let me discuss these options.
If you associate the deposit to an Accounts Receivable (A/R) account, you have the option to link it when receiving an invoice payment. Here's how:
Sign in to your QuickBooks Online account.
Click the + New button, then select Receive payment.
Select the customer from the drop-down.
In the Outstanding Transactions section, choose the invoice you want to receive the payment.