You'll need to set up a liability account where you can track the amount to record a retainer in QuickBooks Online . Here's how:
Go Accounting on the left panel.
Click New at the upper-right corner.
From the Account Type ▼ drop-down menu, select Current Liabilities.
From the Detail Type ▼ drop-down menu, Trust Accounts - Liabilities.
Enter a name for the account.
Select Save and close.
Once done, set up a retainer item and create a trust liability bank account if necessary. Then, enter a sales receipt or invoice to record the retainer and use the retainer as credits. Afterward, transfer the funds from the trust liability account to the operating account.
For more details, please check this article: Record a retainer or deposit. Also, you can reach out to your accountant for further assistance in setting up the affected accounts. They are the ones who help to ensure your data is accurate.
Let me know if you have other concerns. Take care always.