How to tie imported payments to imported invoices for migration

I’m doing a migration into ERPNext and importing a large number of invoices. I want to import the matching payments so they are properly marked as complete.

Once I have imported my entire set of previous invoices, how to I import payments to match up to them so they become marked as complete instead of overdue.

This was previously mentioned a few years ago in this thread and the solution was to first import the payments, then import the invoices. However in my testing so far, that didn’t work, the invoice still shows as overdue.


did you find a solution in the end ?

I have a simular scenario that i have in mind.