Skip to main content

VeriFactu Phase 3: Submission to AEAT

What is Phase 3

VeriFactu Phase 3 is the automatic submission of invoicing records to the Tax Agency (AEAT) using SOAP/XML messages. It complements the previous phases (SHA-256 hash and QR) with the effective transmission of each invoice registration and cancellation to the AEAT's SII system.

With this phase active, Frihet generates the XML according to Order HAC/1177/2024, signs it with your digital certificate, and sends it directly to the AEAT's servers. Everything happens in the background, without manual intervention.

Digital Certificate

To submit records to the AEAT, you need a valid digital certificate. Frihet accepts certificates in .pfx or .p12 format.

Where to obtain a certificate

IssuerTypeCost
FNMT (Fabrica Nacional de Moneda y Timbre)Individual or legal entityFree
CamCert (Camaras de Comercio)CompanyVariable
ACCV (Comunitat Valenciana)RegionalFree

Upload the certificate

  1. Go to Settings > Compliance
  2. In the Digital Certificate section, click Upload certificate
  3. Select your .pfx or .p12 file
  4. Enter the certificate password
Password Encryption

Your certificate password is encrypted with AES-256-GCM before storage. It is never stored in plain text.

Sandbox vs Production

The Sandbox mode toggle in Settings > Compliance allows submitting records to the AEAT's test environment before activating real submission.

  • Sandbox: records are sent to the test endpoint. The AEAT validates them but does not officially register them. Useful for verifying that the certificate and data are correct.
  • Production: records are sent to the official endpoint. Invoices are registered in the AEAT's SII system.
tip

Activate sandbox mode during the first few days to confirm that your certificate works correctly and that data is generated without errors.

Automatic Submission

Activation

  1. Go to Settings > Compliance
  2. Activate the Automatically submit to AEAT toggle

With this toggle active, each issued or cancelled invoice is automatically submitted:

Registration Flow (invoice issued)

  1. The SHA-256 hash of the invoice is calculated (immutable string)
  2. The registration XML is generated according to AEAT specification
  3. The XML is signed with your digital certificate
  4. It is sent via SOAP to the AEAT endpoint
  5. The response (assigned CSV or error) is stored

Cancellation Flow (invoice cancelled)

  1. The cancellation hash is calculated with the 5 required fields
  2. The cancellation XML is generated
  3. It is signed and sent to the AEAT endpoint
  4. The response and cancellation status are stored

Both flows are fire-and-forget: the user can continue working while the submission is processed in the background.

Manual Submission

If automatic submission is not active, or if you need to resubmit a specific invoice:

  1. Open the invoice in question
  2. Click on the actions menu (three dots)
  3. Select Submit to AEAT
  4. A confirmation dialog with the hash preview is shown
  5. Confirm to initiate the submission

Manual submission follows the same technical flow as automatic submission.

Submission Statuses

Each invoice displays a badge with its submission status to the AEAT:

StatusBadgeDescription
PendingOutline (no color)Hash calculated, submission not initiated
SubmittedGreySOAP message sent, awaiting AEAT response
AcceptedGreenThe AEAT has accepted the record and assigned a CSV code
RejectedRedThe AEAT has rejected the record. See error details
ErrorRedTechnical error in submission (network, certificate, timeout)

Check the status

The submission status is visible in:

  • The detail view of each invoice (badge next to the number)
  • The general invoice list (status column)
  • The expanded ledger (additional columns)

Automatic Retries

When a submission fails due to a technical error (timeout, network error, AEAT service unavailable), Frihet automatically retries:

  • Frequency: every 15 minutes
  • Maximum attempts: 3
  • After 3 failures: the status remains as Error and requires manual intervention

To manually retry an invoice with an Error status:

  1. Open the invoice
  2. On the red status badge, click Retry
  3. A new submission attempt is executed

Indicators in PDF

Invoices accepted by the AEAT include additional information in the generated PDF:

  • Badge "Registered with AEAT" in the document header
  • CSV code assigned by the AEAT, next to the verification QR

These indicators only appear when the submission status is Accepted.

Expanded Ledger

With Phase 3 active, the ledger of issued invoices includes 3 additional columns:

ColumnDescription
AEAT Submission StatusStatus of the registration submission (Pending, Submitted, Accepted, Rejected, Error)
AEAT CSVSecure verification code assigned by the AEAT upon accepting the record
AEAT Cancellation StatusStatus of the cancellation submission (if applicable)

These columns are added to the end of the exported CSV, after the 12 standard columns.

Troubleshooting

"Certificate not configured"

No digital certificate has been uploaded. Go to Settings > Compliance and upload your .pfx or .p12 file.

"Tax ID not configured"

The tax profile does not have a Tax ID. Go to Settings > Tax Profile and complete your tax identifier.

SOAP Error / Connection Error

Possible causes:

  • Expired certificate: verify the validity date of your certificate. FNMT certificates have a validity of 4 years.
  • Incorrect password: re-upload the certificate with the correct password.
  • AEAT service unavailable: the AEAT has maintenance windows. The system will automatically retry.
  • Incomplete tax data: verify that your Tax ID, tax address, and company data are complete.
Expired Certificate

An expired certificate blocks all submissions. Renew your certificate with FNMT or CamCert before the expiration date.

Invoice rejected by AEAT

The AEAT may reject a record due to:

  • Issuer's Tax ID does not match the certificate
  • Incorrect date format
  • Invalid invoice type for the operation

Review the error message in the invoice details. Correct the data and use Retry to resubmit.

The obligation to submit to the AEAT has staggered deadlines according to RDL 15/2025:

Taxpayer typeDeadline
Companies (S.L., S.A.)January 1, 2027
Freelancers (individual)July 1, 2027
info

Frihet already supports submission to the AEAT. It is recommended to activate sandbox mode in advance to validate the configuration before the obligation comes into force.

Relation to other phases

  • Phase 1 (SHA-256 Hash): automatically calculated for each invoice. It is the basis of the record. See VeriFactu.
  • Phase 2 (AEAT QR): the QR code in the PDF links to the AEAT's electronic headquarters for verification.
  • Phase 3 (AEAT Submission): this page. Effective transmission of the record to the AEAT via SOAP/XML.

Previous: VeriFactu | Next: Immutability and Record-keeping