I worked on this a while back but didn’t get much further than proof-of-concept, if I recall correctly. More or less gave up when I realised that there wasn’t any easy way to look up an invoice by its id - a feature request that has, disappointingly, languished for around 11 years - and so I’d have to do a ton of paging instead.