Creating invoice in Producer accounting system for total products provided to Order Cycle

We did this in the Option 2 way. Then we use Zapier to create the invoices in Producer accounting packages. @maikel reckons would be much better to just create this API endpoint so we can all use it than try to do anything more with the script i.e. not worth trying to work out how to share it