Thanks for the information.
I’ve tried to create a shortcode to do what I’m after using your function wpinv_insert_invoice().
Bizarrely it seems to get stuck in a loop and create 1000s of invoices before the webbrowser comes back with an error.
Here’s my code, I’ve literally just grabbed it from your examples and modified it to be a shortcode. Probably done something basic wrong.