Quick overview
This workflow runs manually to validate Portuguese NIF tax IDs, verify configured VAT taxes in InvoiceXpress, and then create a draft invoice-receipt (fatura-recibo) via the InvoiceXpress API, returning the new document ID and totals.
How it works
- Runs when you execute the workflow manually with the provided sample payment data.
- Normalizes the payment fields (customer, NIF, items, amount, and VAT rate) into a consistent structure.
- Validates the payment totals and VAT rates, checks the Portuguese NIF check digit, and falls back to “Consumidor final” when the NIF is missing/invalid based on your settings.
- Calls the InvoiceXpress API to list available taxes and verifies that each configured tax name exists with the expected percentage.
- Builds the InvoiceXpress payload with net unit prices, selected taxes, and optional series and tax-exemption reason.
- Creates a draft invoice-receipt in InvoiceXpress and outputs the created document ID, total, and any validation warnings.
Setup
- Create an InvoiceXpress API key and add an n8n HTTP Custom Auth credential that sends it as a query string (for example:
{ "qs": { "api_key": "YOUR_API_KEY" } }) and select it on both InvoiceXpress HTTP Request steps.
- Update
invoicexpress_base_url in the Configuration data to your account URL (for example: https://YOUR-ACCOUNT.app.invoicexpress.com).
- Ensure your InvoiceXpress account has taxes set up to match your
taxas_iva mapping (tax name per VAT rate) and fill motivo_isencao if you use any 0% VAT items.
- Adjust the sample payment fields (customer details, NIF, description, amount, and
taxa_iva) and then execute the workflow to generate a draft document.
Requirements
- An InvoiceXpress account with API access.
Customization
- Replace the manual trigger with a Webhook or Form trigger. Field names are Portuguese: nome (name), valor (amount with VAT), taxa_iva (VAT rate).
Additional info
Tested on n8n 2.41.6 (self-hosted) with a simulated InvoiceXpress API built from the official docs; not yet tested on a real InvoiceXpress account.
Full version: the full version on Gumroad creates and finalises the invoice right after a Stripe or webhook payment, sends it to the customer, never duplicates invoices and alerts you by email when something fails.
Em português: valida o NIF e cria um rascunho de fatura-recibo no InvoiceXpress.