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.
InvoiceSubmission (XML schema: RegistroAltaType) represents a new invoice registration request sent to AEAT. It extends InvoiceRecord, which in turn extends the abstract Model base class.
Verifactu::registerInvoice() to submit it to AEAT.
Properties inherited from InvoiceRecord
These fields are common to both InvoiceSubmission and InvoiceCancellation. They must be set on every record.
Required inherited fields
Schema version identifier (
IDVersion). Defaults to '1.0' and should not need to be changed unless AEAT releases a new schema version.Invoice identification block (
IDFactura). Contains the issuer’s NIF, the series + invoice number, and the issue date. Set via setInvoiceId(). See InvoiceId.Hash-chaining data (
Encadenamiento). Links this record to the previous one in the submission chain, or marks it as the first record. Set via setChaining() or setAsFirstRecord(). See Chaining.Billing software information (
SistemaInformatico). Identifies the software system generating the invoice. Set via setSystemInfo(). See ComputerSystem.ISO 8601 timestamp with timezone offset for when the record was generated (
FechaHoraHusoGenRegistro). Example: '2025-01-15T10:30:00+01:00'. Use date('Y-m-d\TH:i:sP') to generate dynamically.Hash algorithm used (
TipoHuella). Always HashType::SHA_256 ('01') as mandated by AEAT. You do not need to set this manually.SHA-256 chain hash (
Huella) of this record. Automatically computed by the library before submission — do not set manually.Optional inherited fields
Free-form external reference (
RefExterna, optional). Use this to store your own internal identifier (e.g. your ERP’s invoice ID) alongside the AEAT record. Max 60 characters per the XSD.End date for voluntary VERI*FACTU submission (
FechaFinVeriFactu, optional). Must be '31-12-YYYY' format (December 31st of the current or previous year). Used when voluntarily ceasing VERI*FACTU submissions. Corresponds to AEAT validation rule 31.1.3.InvoiceSubmission-specific properties
Required fields
Issuer’s full legal name or company name (
NombreRazonEmisor). Example: 'Mi Empresa S.L.'Invoice type code (
TipoFactura). Determines recipient requirements and validation rules.| Enum case | Value | Description |
|---|---|---|
InvoiceType::STANDARD | F1 | Standard invoice (Art. 6, 7.2, 7.3 RD 1619/2012). Recipient required. |
InvoiceType::SIMPLIFIED | F2 | Simplified invoice / no-recipient-ID invoice (Art. 6.1.d). Recipient not required (or not allowed unless identified). |
InvoiceType::REPLACEMENT | F3 | Replacement for previously declared simplified invoices. Recipient required. |
InvoiceType::RECTIFICATION_1 | R1 | Rectification invoice (Art. 80.1, 80.2, law-based errors). Recipient required. |
InvoiceType::RECTIFICATION_2 | R2 | Rectification invoice (Art. 80.3). Recipient required. |
InvoiceType::RECTIFICATION_3 | R3 | Rectification invoice (Art. 80.4). Recipient required. |
InvoiceType::RECTIFICATION_4 | R4 | Rectification invoice (other cases). Recipient required. |
InvoiceType::RECTIFICATION_SIMPLIFIED | R5 | Rectification for simplified invoices. Recipient not allowed. |
Free-text description of the operation (
DescripcionOperacion). Example: 'Consulting services — January 2025'Total tax amount applied across all breakdown lines (
CuotaTotal). Must match the sum of taxAmount values in the breakdown details.Total invoice amount including tax (
ImporteTotal). The final amount the recipient pays.Optional fields
Rectification method (
TipoRectificativa). Required when invoiceType is any R1–R5 code.| Enum case | Value | Description |
|---|---|---|
RectificationType::SUBSTITUTIVE | S | Full substitution of the original invoice |
RectificationType::INCREMENTAL | I | Only the difference from the original is recorded |
Date the operation actually occurred if different from the issue date (
FechaOperacion, optional). Format: YYYY-MM-DD.Flags this as a simplified invoice under Art. 72–73 LIVA (
FacturaSimplificadaArt7273, optional). Use YesNoType::YES / YesNoType::NO.Flags the invoice as issued without recipient identification under Art. 6.1.d RD 1619/2012 (
FacturaSinIdentifDestinatarioArt61d, optional).Macrodata indicator (
Macrodato, optional). Use YesNoType::YES for invoices above the macrodata threshold defined by AEAT.Indicates who issued the invoice when it is not the obliged party (
EmitidaPorTerceroODestinatario, optional).| Enum case | Value | Description |
|---|---|---|
ThirdPartyOrRecipientType::RECIPIENT | D | Issued by the recipient |
ThirdPartyOrRecipientType::THIRD_PARTY | T | Issued by a third party |
Coupon indicator (
Cupon, optional). Set to YesNoType::YES when the invoice relates to a coupon operation.Invoice agreement registration number (
NumRegistroAcuerdoFacturacion, optional).Computer system agreement identifier (
IdAcuerdoSistemaInformatico, optional).Methods
setInvoiceId(InvoiceId|array $invoiceId): static
Sets the invoice identifier. Accepts either an InvoiceId object or a plain array with issuerNif, seriesNumber, and issueDate keys.
setBreakdown(Breakdown|array $breakdown): static
Replaces the entire tax breakdown. Accepts a Breakdown object or an array of breakdown item arrays. Prefer addBreakdownDetail() for individual lines.
addBreakdownDetail(BreakdownDetail|array $detail): static
Adds a single tax line to the breakdown. Lazily creates a Breakdown instance if none exists. See BreakdownDetail for the full property list.
setChaining(Chaining|array $chaining): static
Sets the chaining data linking this record to the previous submission. Accepts a Chaining object or an array. For the very first invoice in a chain, use setAsFirstRecord() instead.
setAsFirstRecord(): static
Convenience method. Creates a Chaining object with firstRecord = 'S' and sets it on the submission. Use this for the first invoice you ever submit for an issuer/system combination.
setSystemInfo(ComputerSystem|array $systemInfo): static
Sets the billing software information. Accepts a ComputerSystem object or a legacy array with system, version, providerName, etc. keys.
addRecipient(LegalPerson|array $recipient): static
Adds a recipient to the Destinatarios list. Recipient requirement depends on invoiceType:
| Invoice type | Recipient rule |
|---|---|
| F1 (STANDARD) | Required — at least one recipient must be added |
| F2 (SIMPLIFIED) | Not required; not allowed unless invoiceWithoutRecipient is explicitly set to NO |
| F3 (REPLACEMENT) | Required |
| R1–R4 (RECTIFICATION) | Required |
| R5 (RECTIFICATION_SIMPLIFIED) | Not allowed |
setThirdParty(LegalPerson|array $thirdParty): static
Sets the third-party issuer (Tercero). Used when issuedBy is ThirdPartyOrRecipientType::THIRD_PARTY.
setRectificationData(array $data): static
Replaces all rectification reference data at once. The array may contain:
'rectified'— array of rectified invoice references (FacturasRectificadas)'substituted'— array of substituted invoice references (FacturasSustituidas)
issuerNif, seriesNumber, and issueDate.
addRectifiedInvoice(string $issuerNif, string $seriesNumber, string $issueDate): static
Appends a single rectified invoice reference to the FacturasRectificadas list.
addSubstitutedInvoice(string $issuerNif, string $seriesNumber, string $issueDate): static
Appends a single substituted invoice reference to the FacturasSustituidas list.
addBreakdownItem(float $rate, float $base, float $amount): static
Adds a simplified tax breakdown line using raw rate, base, and amount values. Internally creates a addBreakdownItem(float $rate, float $base, float $amount): staticBreakdownDetail with operationQualification forced to OperationQualificationType::SUBJECT_NO_EXEMPT_NO_REVERSE.
setRectificationBreakdown(RectificationBreakdown|array $data): static
Sets the rectification amounts breakdown (ImporteRectificacion). Required for rectification invoices that use substitutive (S) rectification type. See RectificationBreakdown.
validate(): array
Validates all properties against the model’s rule set. Returns an empty array on success, or an associative array of 'ClassName::$property' => ['error message', ...] on failure. Validation is also run automatically before submission.