Documentation 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.
InvoiceQuery lets you query the AEAT’s VERI*FACTU registry to retrieve invoice records for a given NIF/tax ID. This is useful for reconciliation, auditing, or verifying that records were correctly registered. The class wraps the AEAT’s ConsultaFactuSistemaFacturacion SOAP operation and returns responses as typed RespuestaConsultaFactuSistemaFacturacion objects, which can then be converted into Invoice business objects.
La consulta se realiza contra el entorno de pruebas de la AEAT por defecto. Para apuntar al entorno de producción, configure
Settings.Current.VeriFactuEndPointPrefix con el prefijo del endpoint de producción antes de ejecutar cualquier consulta.Constructor
| Parámetro | Tipo | Descripción |
|---|---|---|
partyID | string | NIF del obligado tributario (vendedor) sobre el que ejecutar la consulta. |
partyName | string | Nombre o razón social correspondiente al NIF. |
Consulta de facturas emitidas (ventas)
UseGetSales(year, month) to retrieve issued invoices for a given year and month. Both parameters are strings.
Consulta de facturas recibidas (compras)
UseGetPurchases(year, month) to query invoices received by the party (as buyer):
Filtros disponibles
BothGetSales and GetPurchases accept the period as year/month strings. For more advanced filtering — such as by specific invoice number or with a custom ConsultaFactuSistemaFacturacion filter object — use GetDocuments() and build the query manually via GetRegistro():
Paginación
The AEAT returns results in pages. When a response contains more records than the page size, useClavePaginacion as the offset parameter on subsequent calls to retrieve the next page.
offset parameter on GetSales and GetPurchases accepts a ClavePaginacion object. When offset.IDEmisorFactura is null, the library automatically sets it to PartyID before sending the request.
Convertir respuesta en objetos Invoice
InvoiceQuery.GetInvoices() is a static helper that converts a RespuestaConsultaFactuSistemaFacturacion into a List<Invoice>:
Invoice is populated with:
InvoiceID,InvoiceDate,SellerIDInvoiceType,RectificationTypeBuyerID,BuyerName(if present in the response)TaxItems(converted fromDesglose)- Calculated totals (
TotalAmount,TotalTaxOutput, etc.)
Uso del certificado
All query methods accept an optionalX509Certificate2 certificate parameter. If omitted, the certificate configured in Settings.Current is used automatically.