Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eseperio/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
InvoiceCancellation (XML schema: RegistroAnulacionType) voids a previously registered invoice record in AEAT. It extends InvoiceRecord and shares most base fields with InvoiceSubmission.
Verifactu::cancelInvoice().
Properties inherited from InvoiceRecord
These fields are identical in behaviour to their counterparts on InvoiceSubmission. Refer to the InvoiceSubmission reference for full descriptions.
| Property | Type | Required | Description |
|---|---|---|---|
$versionId | string | Yes (default '1.0') | Schema version (IDVersion) |
$invoiceId | InvoiceId | Yes | Invoice being cancelled (IDFacturaAnulada) — set via setInvoiceId() |
$chaining | Chaining | Yes | Hash-chain link to previous record — set via setChaining() or setAsFirstRecord() |
$systemInfo | ComputerSystem | Yes | Billing software info — set via setSystemInfo() |
$recordTimestamp | string | Yes | ISO 8601 timestamp of record generation |
$hashType | HashType | Yes (default SHA_256) | Always HashType::SHA_256 |
$hash | string | Auto | SHA-256 chain hash, computed automatically |
$fechaFinVeriFactu | string|null | No | End date for voluntary VERI*FACTU cessation (31-12-YYYY format) |
Cancellation-specific properties
Required fields
Full legal name of the invoice issuer (
NombreRazonSocialEmisor). Must match the name used when the original invoice was registered. Example: 'Mi Empresa S.L.'Optional fields
External reference string (
RefExterna, optional). Free-form identifier for your internal records. Note: this property is named externalReference on InvoiceCancellation (vs. externalRef on InvoiceSubmission).No-previous-record indicator (
SinRegistroPrevio, optional). Set to YesNoType::YES when cancelling an invoice that was never successfully registered with AEAT (e.g. it was rejected at the time of submission and a prior registration record does not exist).| Enum case | Value |
|---|---|
YesNoType::YES | 'S' |
YesNoType::NO | 'N' |
Previous rejection indicator (
RechazoPrevio, optional). Set to YesNoType::YES to flag that the original submission attempt was rejected by AEAT and this cancellation covers that rejected record.Who generated this cancellation record (
GeneradoPor, optional). Used when the cancellation is not initiated by the tax obligor themselves.| Enum case | Value | Description |
|---|---|---|
GeneratorType::ISSUER | 'E' | The obliged issuer generated the cancellation |
GeneratorType::RECIPIENT | 'D' | The invoice recipient generated it |
GeneratorType::THIRD_PARTY | 'T' | A third party generated it |
Identity of the generator (
Generador, optional). Required when generator is set to RECIPIENT or THIRD_PARTY. Set via setGeneratorData(). See LegalPerson.Methods
setInvoiceId(InvoiceId|array $invoiceId): static
Sets the identification of the invoice to be cancelled. The values must exactly match those used when the invoice was originally registered.
setChaining(Chaining|array $chaining): static
Sets the hash-chaining link. Cancellation records are part of the same submission chain as registration records, so this must reference the hash of the immediately preceding record (registration or cancellation).
setAsFirstRecord(): static
Marks this cancellation as the first record in a chain. Rarely needed for cancellations — use only if no prior records exist for this issuer/system combination.
setSystemInfo(ComputerSystem|array $systemInfo): static
Sets the billing system information. See ComputerSystem.
setGeneratorData(LegalPerson|array $generatorData): static
Sets the identity of the entity that generated the cancellation. Accepts a LegalPerson object or an array with name and either nif or otherId keys.
toXml(): \DOMDocument
toXml(): \DOMDocument