E-Invoicing / Fiscal Document Management is where ERP discipline either begins or breaks.
E-Invoicing Mandate Compliance (LATAM - Mexico CFDI, Brazil NF-e) looks operational from far away. In a real finance team, it is a chain of assertions: the right actor started the work, the required records existed, the control policy was applied, the state change was preserved, and the outcome can be explained later without rebuilding the transaction from emails and spreadsheets.
The expected business outcome is specific: Every outbound invoice carries a valid fiscal stamp; company is in full CFDI/NF-e compliance and can present audit-ready documents on demand.
The control flow a finance team actually needs.
Step 1
XML Generation Conforms To The Current...
Step 2
Digital Certificate Rotation Handled...
Step 3
Transmission Timeout Triggers Automatic...
Step 4
Authorization Code Stored On Invoice...
Step 5
Cancellation Only Through...
The ERP surface involved.
Module
E-Invoicing / Fiscal Document Management
Actors
Billing Clerk, Certified PAC (Mexico) / SEFAZ (Brazil), Tax Authority
Tier
Tier 2
Finance area
Tax & Regulatory Compliance
Region lens
US and UK finance teams
Publication date
April 17, 2026
XML generation conforms to the current schema published by SAT/SEFAZ; digital certificate rotation handled without downtime; transmission timeout triggers automatic retry with idempotency key; authorization code stored on invoice record; cancellation only through authority-approved workflow; XML archive retained for the statutory period (5 years Mexico, 5 years Brazil); contingency mode for authority unavailability.
US and UK teams have different compliance hooks, but the same control problem.
US teams usually care about clean evidence for audit support, vendor records, payment controls, tax reporting, and management review. UK teams usually care about VAT-ready records, approval evidence, digital-record discipline, and traceable postings. The country-specific details differ, but the operating pattern is the same: the ERP needs controlled records, explicit ownership, defensible state changes, and evidence that survives beyond the person who completed the task.
The control matrix.
| Control area | Requirement | Acceptance proof |
|---|---|---|
| Control 1 | XML generation conforms to the current schema published by SAT/SEFAZ | Given a confirmed customer invoice for a CFDI or NF-e mandated entity |
| Control 2 | digital certificate rotation handled without downtime | when the fiscal XML is generated, signed with the company's digital certificate, and transmitted to the PAC/SEFAZ |
| Control 3 | transmission timeout triggers automatic retry with idempotency key | then the authorization code (UUID/folio fiscal or chave de acesso) is returned and stored on the invoice record, and the stamped document is emailed to the customer |
| Control 4 | authorization code stored on invoice record | negative) when the transmission times out then the ERP automatically retries with the same idempotency key and if the authority is unavailable enters contingency mode, flagging the invoice as CONTINGENCY_PENDING. |
| Control 5 | cancellation only through authority-approved workflow | Every outbound invoice carries a valid fiscal stamp; company is in full CFDI/NF-e compliance and can present audit-ready documents on demand. |
| Control 6 | XML archive retained for the statutory period (5 years Mexico, 5 years Brazil | Every outbound invoice carries a valid fiscal stamp; company is in full CFDI/NF-e compliance and can present audit-ready documents on demand. |
Audit evidence is a chain, not a folder.
| Evidence layer | What should be preserved |
|---|---|
| Business event | When a customer invoice is confirmed, the ERP automatically generates the fiscal XML document (CFDI 4.0 for Mexico, NF-e 4.0 for Brazil) with all mandatory tax fields. The XML is signed with the company's digital certificate (FIEL/e-CNPJ) and transmitted to the authorized certifier (PAC in Mexico, SEFAZ in Brazil) for validation and stamping. The authority returns an authorization code (UUID/folio fiscal for Mexico, chave de acesso for Brazil). The stamped document is attached to the customer invoice record, emailed to the customer, and archived. Cancellation follows the mandated process (cancellation CFDI or NF-e cancellation event). |
| Control rules | XML generation conforms to the current schema published by SAT/SEFAZ; digital certificate rotation handled without downtime; transmission timeout triggers automatic retry with idempotency key; authorization code stored on invoice record; cancellation only through authority-approved workflow; XML archive retained for the statutory period (5 years Mexico, 5 years Brazil); contingency mode for authority unavailability. |
| Acceptance proof | Given a confirmed customer invoice for a CFDI or NF-e mandated entity; when the fiscal XML is generated, signed with the company's digital certificate, and transmitted to the PAC/SEFAZ; then the authorization code (UUID/folio fiscal or chave de acesso) is returned and stored on the invoice record, and the stamped document is emailed to the customer; (negative) when the transmission times out then the ERP automatically retries with the same idempotency key and if the authority is unavailable enters contingency mode, flagging the invoice as CONTINGENCY_PENDING. |
| Data record | |
| System event | |
| Lifecycle state | |
The useful version of this workflow is not only fast. It is inspectable. A controller, auditor, or operator should be able to move from source event to system record to state transition to final business outcome without guessing.
Implementation contracts.
Reference data model
`fiscal_document` { id: string, invoice_id: string, country: enum(MX,BR), schema_version: string, xml_content: text, certificate_serial: string, authorization_code: string, authorized_at: timestamp, status: enum(PENDING,AUTHORIZED,REJECTED,CANCELLED,CONTINGENCY_PENDING), contingency_reason: string, external_id: string }; (reference, product may differ).API and events
`POST /v1/fiscal-documents` { invoice_id, country } -> 202 { id, status }; `GET /v1/fiscal-documents/{id}` -> 200 { authorization_code, status, xml_url }; `POST /v1/fiscal-documents/{id}/cancel` { reason } -> 202; emits `fiscal_document.authorized`, `fiscal_document.rejected`, `fiscal_document.cancelled` events; idempotent via `external_id`.State transitions
`PENDING -> AUTHORIZED`; `PENDING -> REJECTED`; `PENDING -> CONTINGENCY_PENDING`; terminal `CANCELLED`; guard: cancellation must follow authority-approved workflow; authorized documents are immutable; archive retained for statutory period.Common implementation traps.
Treating the workflow as data entry
If the ERP only stores the final record, the team loses the decision trail that explains how the record became valid.
Hiding exception logic
Exceptions need owners, reason codes, and time stamps. A vague pending state is not a control.
Posting without recovery design
Retries, duplicate submissions, and partial failures must be explicit so the system does not create inconsistent records.
Skipping evidence design
A workflow that cannot produce evidence on demand will eventually push finance teams back into manual screenshots and spreadsheets.
Where Rivane fits.
Rivane is built for finance workflows where automation must stay tied to source documents, approvals, state transitions, ledger impact, reporting, and audit evidence. Use this guide as a checklist for evaluating whether an ERP workflow is merely digitized or actually controlled.
References and source basis.
These sources provide the standards, regulatory, or government context around the flow. They are included so the guide is useful to finance operators, auditors, and implementation teams, not only buyers reading software copy.