Issuing an invoice in Base
addInvoice issues an invoice for an order using a chosen numbering series.
invoice_id, which you then use for downloading the file (getInvoiceFile) or listing invoices (getInvoices).
Replacing it with an invoice from an external system
If you issue invoices in your own ERP (and don’t want to duplicate numbering in both Base and your system), useaddOrderInvoiceFile — it replaces the standard Base invoice with your own PDF (or XML, for countries where that’s allowed, e.g. Brazil).
Recommended flow
- Your ERP issues an invoice (number, PDF).
- In Base, create an invoice for the order via
addInvoice(you just need a validseries_id— the specific number/rate doesn’t matter much since you’ll overwrite it shortly). - Call
addOrderInvoiceFilewith theinvoice_idfrom step 2, attach the PDF from your ERP, and setexternal_invoice_numberto the real number from your system. - Forwarding the invoice further to the marketplace (if the integration supports it) is typically tied to a specific order status — configured per integration, similar to tracking numbers. Timing (batches, not instant) is described in Automation and webhooks.