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.