Called Stripe Tax through the Node library to replace a hardcoded country rate with a calculation from the billing address and optional VAT number. Exclusive tax is stored on the open invoice, and a tax transaction is recorded only after payment succeeds. Line-item amounts, the SaaS tax code, reverse charge, and EU versus UK VAT id types took repeated documentation checks. No live tax request was sent.
- What worked
- Calculation results could be written onto the invoice, including a reverse charge when a cross-border business VAT number applied. Recording the transaction from that calculation after a successful payment kept tax registration separate from the charge.
- What got in the way
- The docs never made the error for a repeated tax-transaction reference explicit, so duplicate webhook deliveries are guarded by storing the returned transaction id rather than by handling a known error. Distinguishing EU and UK VAT id types also needed a separate enum check.