{"product_id":"moloni-draft-invoice-receipt-automation-in-n8n-with-nif-validation","title":"Moloni Draft Invoice-Receipt Automation in n8n with NIF Validation","description":"\u003ch3\u003eGenerate a Moloni Draft Invoice-Receipt in n8n—complete with Portuguese NIF validation\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow takes sample payment data, validates Portuguese NIF\/VAT configuration, then uses the \u003cstrong\u003eMoloni API\u003c\/strong\u003e to create a \u003cstrong\u003edraft fatura-recibo\u003c\/strong\u003e (invoice-receipt) with the correct customer, tax rates, and payment lines.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns manually\u003c\/strong\u003e (Manual Trigger) using the included sample payment payload.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNormalizes and validates input\u003c\/strong\u003e: checks required configuration values, validates payment totals and the VAT rate, and performs Portuguese \u003cstrong\u003eNIF check-digit validation\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates Moloni tax configuration\u003c\/strong\u003e: requests an \u003cstrong\u003eaccess token\u003c\/strong\u003e from the Moloni API, fetches the company’s VAT taxes, and confirms that each configured \u003cstrong\u003eMoloni tax ID\u003c\/strong\u003e matches the expected percentage.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFinds or creates the customer\u003c\/strong\u003e in Moloni by VAT\/NIF. If the NIF is missing\/invalid (based on configuration), it uses \u003cstrong\u003e“Consumidor final”\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eBuilds the Moloni invoice-receipt payload\u003c\/strong\u003e (product\/payment lines and applicable taxes) and sends it to Moloni to create the document as a \u003cstrong\u003edraft\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReturns outputs for review\u003c\/strong\u003e, including the created Moloni document ID and any validation warnings so you can finalize it in Moloni.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eTest and verify \u003cstrong\u003eMoloni invoice-receipt automation\u003c\/strong\u003e before connecting real payments.\u003c\/li\u003e\n  \u003cli\u003eEnsure \u003cstrong\u003ePortuguese NIF validation\u003c\/strong\u003e and correct VAT mapping to avoid tax mismatches.\u003c\/li\u003e\n  \u003cli\u003eSaaS operators prototyping an invoicing workflow that must create customers on-the-fly in Moloni.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003en8n nodes\/stacks: \u003cstrong\u003emanual trigger\u003c\/strong\u003e, \u003cstrong\u003eHTTP Request\u003c\/strong\u003e, \u003cstrong\u003eCode\u003c\/strong\u003e, \u003cstrong\u003eSet\u003c\/strong\u003e, \u003cstrong\u003eIf\u003c\/strong\u003e, and supporting notes (e.g., Sticky Note).\u003c\/li\u003e\n  \u003cli\u003eIntegrations: \u003cstrong\u003eMoloni API\u003c\/strong\u003e via HTTP with \u003cstrong\u003en8n HTTP Custom Auth\u003c\/strong\u003e (client_id, client_secret, username, password).\u003c\/li\u003e\n  \u003cli\u003eCore logic includes NIF check-digit validation, Moloni VAT tax fetching, customer lookup\/creation, and draft fatura-recibo creation.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46190227062963,"sku":"N8N-20641","price":16.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/u-muNQRH8Q2ZFE-rC5ibt_1pnrruFG.png?v=1791450540","url":"https:\/\/buyflowscripts.com\/products\/moloni-draft-invoice-receipt-automation-in-n8n-with-nif-validation","provider":"N8N Commerce","version":"1.0","type":"link"}