
Real-time invoicing architecture for Spain: SII, VeriFactu, and ERP integration
Spain’s SII and VeriFactu frameworks have changed the technical requirements around invoicing and value-added tax (VAT) reporting.
What was previously handled through periodic reporting and reconciliation must now operate through near real-time data flows between ERP systems, invoicing platforms, compliance engines, and the Spanish Tax Agency (AEAT).
This is an architectural challenge for IT and finance teams. Invoice data must be extracted, validated, transformed, submitted, monitored, corrected, and retained continuously — without disrupting operational billing systems.
This is no longer just a reporting problem. Businesses managing SII and VeriFactu compliance in real-time increasingly need a unified architecture that supports both VAT reporting and invoice integrity from the same underlying transaction flow.
Let’s evaluate what systems architecture is required to achieve compliant, scalable real-time invoicing in Spain.
Key takeaways
- SII and VeriFactu require real-time, system-driven compliance. Invoice data must be extracted, validated, transmitted, and monitored continuously through integrated architecture.
- A fragmented architecture creates operational risk. Separate SII and VeriFactu workflows lead to duplicated integrations, inconsistent reconciliation, and higher maintenance overhead.
- Middleware is increasingly the scalable model. Certified compliance layers centralise AEAT integration, validation, monitoring, retry handling, and audit logging without requiring ERP replacement.
- Automation is essential at scale. Manual submission handling, correction workflows, and reconciliation processes become unmanageable as invoice volumes and entities increase.
The core compliance architecture problem
SII and VeriFactu impose different obligations, but both depend on the same source data.
SII requires businesses to submit structured VAT ledger records to AEAT within strict reporting windows. VeriFactu requires invoice records to be generated, chained, stored, and controlled in a compliant way before reporting takes place.
The problem is that many organisations treat these as separate projects. One workflow extracts data for SII reporting. Another generates VeriFactu records. Different teams manage validation, error handling, reconciliation, and audit logging independently.
This creates duplication. ERP systems generate invoice data once, but businesses often:
- Extract it multiple times
- Transform it differently across systems
- Maintain separate monitoring processes
- Reconcile separate outputs later
The operational overhead grows quickly. Without a unified architecture, finance and IT teams end up managing:
- Separate error queues
- Different submission workflows
- Inconsistent reconciliation logic
- Duplicate audit evidence
This is where compliance complexity escalates. The typical pattern looks like this:
- ERP generates invoices
- No certified middleware exists
- SII reporting is handled separately
- VeriFactu integrity controls are layered elsewhere
- Reconciliation happens manually afterward
The result is fragmentation. Businesses already evaluating SII and VeriFactu are increasingly recognising that the challenge is not understanding the rules individually, but designing one architecture that supports both frameworks together.
For technical teams, the real objective is not adding more integrations. It’s reducing duplication by creating a single, traceable compliance flow from invoice generation through to AEAT submission and audit evidence.
Key system components for Spain compliance
A compliant Spain invoicing architecture depends on several connected components working together in real time. The objective is to create a controlled, traceable flow from invoice generation through to reporting, reconciliation, and audit evidence.
1. Source system (ERP or billing platform)
The source system generates the invoice data. This may be:
- SAP
- Oracle
- Microsoft Dynamics
- Ecommerce billing platforms
- POS systems
- Custom invoicing applications
The key requirement is structured output. Invoice data must be exposed in a format the compliance layer can consume consistently. If source data is incomplete, inconsistent, or delayed, downstream reporting and VeriFactu controls fail.
2. Compliance middleware or tax engine
This is the operational core of the architecture. The middleware layer typically handles:
- SII XML generation
- VeriFactu hash chaining
- QR code generation
- AEAT API communication
- Validation rules
- Submission orchestration
Businesses implementing VeriFactu technical requirements increasingly rely on middleware because existing ERP systems rarely support all integrity and reporting requirements natively.
This layer also centralises logic so reporting and invoicing controls are not duplicated across systems.
3. AEAT API endpoints
SII and VeriFactu use separate AEAT web services. Each service has:
- Its own XML schema
- Authentication requirements
- Validation logic
- A response-handling model
This means systems must manage different submission and response workflows even when using the same underlying invoice data.
4. Error handling and retry logic
Submission failure is inevitable at scale. The architecture must:
- Capture AEAT rejection responses
- Retry failed submissions safely
- Prevent duplicate submissions
- Escalate unresolved errors
Without structured retry handling, businesses either lose records or generate duplicate compliance entries.
5. Audit log store
Every submission and response must be retained. This includes:
- Submitted payloads
- AEAT acknowledgements
- Error responses
- Corrections and resubmissions
- Timestamp history
This creates the audit trail needed to support inspections and reconciliation.
6. Reconciliation layer
Finally, businesses need a reconciliation layer that aligns:
- ERP VAT records
- SII submissions
- VeriFactu invoice records
- VAT returns
Without this, finance teams end up manually comparing systems at month-end, recreating the same operational issues the architecture was intended to solve.
Integration patterns: Build vs. buy vs. middleware
Different organisations approach Spain compliance architecture differently depending on ERP maturity, internal engineering capability, and operational scale. The core decision is whether to:
- Build compliance directly into ERP
- Develop integrations internally
- Introduce a dedicated compliance middleware layer
Each approach has trade-offs.
Native ERP build
In this model, the ERP vendor provides SII and VeriFactu functionality directly inside the platform. The advantage is architectural simplicity. There’s:
- One core system
- No additional middleware layer
- Centralised operational ownership
For some businesses, this reduces integration complexity.
The challenge is flexibility. ERP-native compliance capabilities are often:
- Delivered slowly
- Incomplete across jurisdictions
- Difficult to adapt during regulatory changes
- Tightly coupled to the ERP lifecycle itself
This becomes particularly problematic during ERP migration projects or multinational rollouts where different entities use different platforms.
Custom in-house build
Some organisations choose to build AEAT integrations internally. This provides maximum control. Internal teams can:
- Design custom workflows
- Align integrations tightly with ERP processes
- Control monitoring and orchestration directly
The downside is long-term maintenance. AEAT schema updates, authentication changes, validation logic changes, and VeriFactu certification requirements all require ongoing development effort.
This means the architecture becomes a permanent operational responsibility rather than a one-time implementation project. Businesses also need to manage:
- Retry logic
- Audit storage
- Certification implications
- Regression testing
- Multi-entity scaling
The complexity grows quickly.
Certified compliance middleware
The third model introduces a dedicated compliance middleware layer between ERP systems and AEAT. This is increasingly the preferred architecture for organisations managing both SII and VeriFactu. The middleware layer:
- Handles SII XML generation
- Applies VeriFactu controls
- Manages AEAT API communication
- Centralises monitoring and error handling
- Supports audit logging and reconciliation
Middleware is an attractive option because it allows one integration architecture to support both obligations simultaneously. The advantages are operational:
- ERP-agnostic architecture
- Faster adaptation to AEAT changes
- Centralised compliance logic
- Reduced duplication across systems
The trade-off is vendor dependency.
However, for organisations operating multiple ERPs, shared service models, or multinational invoicing environments, middleware is often the most scalable and maintainable option.
Data flow: From invoice to AEAT
A compliant Spain invoicing architecture depends on a continuous, traceable flow of data from the ERP through to AEAT. The process begins when an invoice is created inside the ERP, billing platform, POS system, or ecommerce application.
Step 1: Invoice creation in the source system
The source system generates the operational invoice record. This includes:
- Customer and supplier data
- VAT treatment
- Invoice numbering
- Transaction amounts
- Dates and currency
At this point, the invoice data becomes the foundation for both SII reporting and VeriFactu compliance.
Step 2: Extraction into the compliance layer
The compliance layer extracts invoice data in real time or near real time.
This extraction must happen consistently and without gaps. Delayed or incomplete extraction creates downstream reporting and traceability failures.
Step 3: VeriFactu processing
For VeriFactu workflows:
- A cryptographic hash is generated
- The record is chained to the previous invoice
- A QR code is appended
- The compliant invoice record is prepared for AEAT processing
This is where invoice integrity controls are applied. Businesses implementing VeriFactu technical requirements need this processing to happen automatically because manual intervention breaks traceability and sequencing.
Step 4: SII XML generation and submission
Separately, the compliance layer generates the SII XML record. This record is transmitted to AEAT within the four-calendar-day reporting window. At this stage:
- XML schema validation occurs
- API authentication is applied
- Submission responses are captured
Step 5: AEAT response handling
AEAT returns:
- Accepted responses
- Rejections
- Accepted-with-errors messages
These responses must be processed automatically.
Step 6: Error correction and resubmission
Rejected or flagged records are:
- Logged
- Routed for correction
- Corrected through controlled workflows
- Resubmitted safely without duplication
This is one of the most operationally sensitive parts of the architecture.
Step 7: Audit logging and retention
Finally, all activity is stored:
- Submitted payloads
- Hash-chain history
- AEAT acknowledgements
- Corrections and retries
- Timestamp records
The critical point is automation. Steps 2 to 7 cannot realistically be managed manually at scale. As invoice volumes increase, automated validation, submission, monitoring, and reconciliation become operational necessities rather than optimisation projects.
Common architecture failure modes
Most Spain compliance failures are not caused by misunderstanding regulations. They happen because invoice flows break operationally under load, during retries, or across disconnected systems.
Submission gaps
One of the most common failures is a submission gap. An invoice is created successfully in the ERP, but the SII submission never occurs within the required four-calendar-day window. This typically happens because:
- Queue processing fails silently
- Middleware stops transmitting records
- API connectivity issues are not monitored
- Batch jobs fail without escalation
Without monitoring and retry controls, invoices remain unsubmitted until discovered later during reconciliation or audit review.
Hash chain breaks
VeriFactu introduces a different risk. If the invoice hash chain is interrupted — for example, through failed batch processing, partial outages, or sequence mismatches — subsequent records may no longer validate correctly.
This creates cascading integrity issues because each invoice depends on the previous chain state.
Duplicate submissions
Retry logic introduces another common failure mode. If failed submissions are retried incorrectly, duplicate records may be sent to AEAT. This often happens when:
- Message queues replay transactions
- Timeout handling is inconsistent
- Duplicate detection is missing
At scale, duplicate handling becomes critical because retry activity is inevitable in real-time architecture.
Schema drift
AEAT schemas evolve over time. Custom integrations frequently fail because XML structures, validation rules, or endpoint requirements change and internal systems are not updated quickly enough. In some cases, failures occur silently:
- Records appear processed internally
- AEAT rejects them externally
- Monitoring does not detect the mismatch immediately
This creates hidden backlog and reconciliation risk.
Reconciliation errors
Finally, businesses often struggle to align:
- ERP VAT records
- SII submissions
- VeriFactu invoice logs
- VAT returns
Timing differences, correction workflows, and missing records create discrepancies between systems. This is where certified middleware becomes operationally valuable. Middleware platforms centralise:
- Validation
- Submission orchestration
- Retry handling
- Monitoring
- Reconciliation logic
This reduces fragmentation and makes failure handling consistent across both SII and VeriFactu workflows.
Scalability and multi-entity considerations
For businesses operating multiple Spanish legal entities, SII and VeriFactu complexity increases quickly. Each entity may:
- Have its own VAT registration
- Maintain separate invoice numbering
- Require independent SII submissions
- Operate distinct ERP environments
Without a shared architecture, businesses often end up duplicating integrations, reconciliation workflows, and monitoring processes for each entity separately.
This creates operational fragmentation. A scalable model centralises compliance processing while preserving entity-level reporting separation. In practice, this means:
- Multiple entities feed invoice data into a single compliance layer
- Submission routing is managed centrally
- Error handling follows one operational model
- Audit logs are retained consistently across the group
The benefits are significant:
- Reduced integration duplication
- Centralised monitoring and reconciliation
- Lower operational overhead per entity
- More consistent audit evidence and reporting controls
This is especially important for multinational groups operating Spanish subsidiaries inside wider global ERP landscapes.
Businesses designing real-time invoicing, VAT reporting, and compliance integration architecture increasingly evaluate group-level compliance models rather than treating each Spanish entity independently.
The objective is scalability. As reporting obligations and invoice volumes increase, the architecture must support additional entities and systems without multiplying operational complexity.
How Avalara fits into a Spain compliance architecture
Avalara acts as a compliance middleware layer between ERP systems and AEAT. Rather than requiring businesses to rebuild invoicing systems, Avalara integrates with existing ERP, billing, ecommerce, and POS environments to centralise SII and VeriFactu compliance workflows. This includes support for:
- Real-time SII VAT reporting
- VeriFactu-compliant invoice generation
- XML schema management
- Hash chaining and QR code generation
- AEAT API communication
- Submission monitoring and retry handling
- Audit-ready logging and reconciliation
Because Avalara is ERP-agnostic, it can integrate with environments such as:
- SAP
- Oracle
- Microsoft Dynamics
- Custom billing systems
- Ecommerce platforms
As part of our Agentic Tax and Compliance™ platform, Avalara combines a certified compliance engine with AI-powered orchestration to help automate compliance workflows, improve visibility, and reduce manual processes. Avalara also helps manage ongoing operational complexity, including:
- AEAT schema updates
- Error categorisation and retries
- Submission monitoring
- Multi-entity orchestration
- Audit evidence retention
The result is a more scalable compliance model that supports Spain’s real-time reporting and invoicing requirements without increasing operational fragmentation.
Speak with us today to explore how Avalara can support your Spain compliance strategy.
FAQ
Does SII compliance require replacing our ERP system?
Not necessarily. Many businesses keep their existing ERP and billing systems and introduce a compliance middleware layer that handles AEAT integration, XML generation, validation, and monitoring.
Can the same architecture support both SII and VeriFactu?
Yes. Many organisations are implementing a unified compliance architecture where the same invoice data flow supports both SII VAT reporting and VeriFactu integrity requirements.
What happens if AEAT rejects a submission?
AEAT returns response codes identifying whether records are accepted, accepted with errors, or rejected. Rejected records must be corrected and resubmitted within controlled workflows to avoid reconciliation and audit issues.
Why is middleware often preferred over a custom in-house build?
Middleware centralises validation, retry handling, monitoring, schema updates, and audit logging. This reduces long-term maintenance effort and avoids duplicating compliance logic across ERP systems and entities.

Avalara Tax Changes 2026 is here
The 10th edition of our annual report engagingly breaks down key policies related to sales tax, tariffs, and VAT.
Stay up to date
Sign up for our free newsletter and stay up to date with the latest tax news.