This quickstart walks you through the full onboarding flow for the VeriFactu .NET library: installing the NuGet package, pointing it at your digital certificate, building anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/mdiago/VeriFactu/llms.txt
Use this file to discover all available pages before exploring further.
Invoice object with tax breakdown lines, submitting it to the AEAT VERI*FACTU web service, and inspecting the response. By the end you’ll have a working end-to-end submission running against the AEAT test environment.
Configure your certificate
Before submitting any records to the AEAT you must configure the certificate that will sign and authenticate each request. The entire library configuration is accessible through the static
Settings.Current property. Call Settings.Save() to persist your changes to disk.Load a certificate from a .pfx / .p12 file
Load a certificate from the Windows certificate store
On Windows you can select a certificate already installed in the system store by its serial number or thumbprint (SHA-1 hash). Only one of the two properties is required.| Property | Description |
|---|---|
CertificatePath | Path to the .pfx / .p12 certificate file on disk. |
CertificatePassword | Password for the certificate file. Required only when CertificatePath is set and the file is password-protected. |
CertificateSerial | Serial number used to locate the certificate in the Windows certificate store. |
CertificateThumbprint | SHA-1 thumbprint (fingerprint) used to locate the certificate in the Windows certificate store. |
Create and send an invoice
Construct an
Invoice using the three-argument constructor — invoice number, issue date, and seller tax ID (NIF). Set the optional properties you need (InvoiceType, SellerName, BuyerID, etc.) and populate TaxItems with one TaxItem per VAT rate that applies to the operation.Wrap the Invoice in an InvoiceEntry and call Save(). The library will:- Add the record to the seller’s local blockchain.
- Build and sign the VERI*FACTU XML envelope.
- Submit it to the AEAT web service endpoint.
- Persist the request and response to disk.
Check the response
After
Save() returns, inspect the properties on invoiceEntry to determine the outcome of the submission. A successful submission sets Status to "Correcto" and populates CSV with the AEAT’s Código Seguro de Verificación. If the AEAT rejected the record, ErrorCode and ErrorDescription carry the rejection details.| Property | Type | Description |
|---|---|---|
Status | string | Overall result returned by the AEAT ("Correcto" on success). Maps to EstadoEnvio in the VERI*FACTU response. |
CSV | string | Código Seguro de Verificación issued by the AEAT for a successful submission. null on error. |
ErrorCode | string | AEAT error code (CodigoErrorRegistro) or SOAP fault code when the submission fails. null on success. |
ErrorDescription | string | Human-readable description of the error (DescripcionErrorRegistro) or SOAP fault string. null on success. |
Response | string | Raw XML response envelope returned by the AEAT web service. |
VeriFactu connects to the AEAT test environment (
prewww) by default — no real records are submitted and no fiscal obligations are incurred. When you are ready to go live, update Settings.Current.VeriFactuEndPointPrefix to the production endpoint. See the Settings reference for the full list of configurable endpoints and options.Next steps
Configurar el sistema
Explore every
Settings property — storage paths, AEAT endpoints, blockchain options, and logging.Gestión del certificado
Learn how to load certificates from a file or the Windows store, rotate them, and troubleshoot common issues.
Anular facturas
Submit cancellation records (
RegistroAnulacion) for invoices previously accepted by the AEAT.Control de flujo
Use
InvoiceQueue to handle the AEAT’s mandatory inter-submission wait times and batch up to 1 000 records per call.