Thanks for sharing this! I was looking for some starter code to do the same with a netlify function.
If I understand correctly your code is only handling stripe invoices, not stripe checkout payments. Have you done that before? My idea was to create an invoice in sevdesk and immediately book it. The invoice number could be the Stripe payment receipt number for example.