To cancel a previously submitted invoice, create 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 instance with the same InvoiceID, InvoiceDate, and SellerID as the original submission, then wrap it in an InvoiceCancellation and call .Save(). The library generates a RegistroAnulacion XML record, signs it with your certificate, and sends it to the AEAT endpoint.
Ejemplo de anulación
Comprobar la respuesta
InvoiceCancellation exposes the same response properties as InvoiceEntry:
| Propiedad | Tipo | Descripción |
|---|---|---|
Status | string | Estado del resultado. "Correcto" si la anulación fue aceptada. |
CSV | string | Código Seguro de Verificación devuelto por la AEAT. |
ErrorCode | string | Código de error devuelto por la AEAT (cuando Status != "Correcto"). |
ErrorDescription | string | Descripción del error devuelto por la AEAT. |
Response | string | Respuesta XML completa de la AEAT. |
Diferencias con InvoiceEntry
| Aspecto | InvoiceEntry | InvoiceCancellation |
|---|---|---|
| Registro XML generado | RegistroAlta | RegistroAnulacion |
Valor de InvoiceEntryID | {blockchainLinkID} (20 dígitos) | {blockchainLinkID}.DEL |
| Archivo guardado en disco | {InvoiceEntryID}.xml | {InvoiceEntryID}.xml (p. ej. 00000000000000000001.DEL.xml) |
| Archivo de respuesta | {InvoiceEntryID}.xml | {InvoiceEntryID}.xml (p. ej. 00000000000000000001.DEL.xml) |
TaxItems requeridos | Sí | No (solo se necesitan InvoiceID, InvoiceDate, SellerID y SellerName) |
| Contenido del registro XML | Desglose de impuestos | Solo identificador de la factura a anular |
InvoiceCancellation extends InvoiceEntry, so it inherits the same Save() flow: blockchain post, XML generation, AEAT send, response processing, and automatic rollback on failure.
Consideraciones
La anulación solo es posible si la factura original fue remitida correctamente y la AEAT tiene el registro correspondiente. Si el registro original no existe en el sistema de la AEAT, la anulación será rechazada.