Refund credit card pmt, reopen invoice

I accepted payment for some invoices via credit card and created a new “bank account” for the credit card payment gateway. The invoices are now marked fully paid and the credit card “bank account” shows the invoice amount minus CC processing fees.

I need to reverse it.

(The payment gateway says they can’t accept that payment and must refund it to the customer. Their fees will also refund back to me).

So I need to unwind this – end up with zero balance in the CC account and have the invoices showing “Unpaid”

How do I do that?

You just do the reverse transaction.
Initially you Received Money now you Spend Money - repayment
Spend Money - Account = Accounts Receivable - Invoice (select) - Amount
Now the Paid in Full mark will be removed.
For the CC Fees - Receive Money