Documentation Index
Fetch the complete documentation index at: https://mintlify.com/NemonInvocash/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
RegistroAlta is the primary invoice record submitted to AEAT through the VeriFactu system. It combines the issuer details from an Emisor model with a tax breakdown (Desglose), an optional recipient (Destinatario), an optional third-party issuer (Tercero), and optional references to rectified or substituted invoices (FacturaRectificada, FacturaSustituida). The constructor accepts two arrays — one for sub-model objects and one for scalar data fields — plus a webhook ID integer.
Construction
RegistroAlta takes three constructor arguments:
$objetos— an associative array of sub-model instances.$data— an associative array of scalar field values.$webhookID— an integer webhook ID (pass0to fall back to theEmisor’s default).
Objects array keys
The$objetos array accepts the following keys. Any omitted key defaults to the corresponding ::empty() factory:
| Key | Expected type | Default if omitted |
|---|---|---|
emisor | Emisor | Emisor::empty() |
destinatario | Destinatario | Destinatario::empty() |
desglose | Desglose | Desglose::empty() |
tercero | Tercero | Tercero::empty() |
facturaRectificada | FacturaRectificada | FacturaRectificada::empty() |
facturaSustituida | FacturaSustituida | FacturaSustituida::empty() |
Auto-set fields
Two fields are automatically derived from the attachedEmisor and cannot be set manually via the $data array:
IDEmisorFactura— copied from$emisor->getNif().NombreRazonEmisor— copied from$emisor->getNombre().
setEmisor(), both fields are updated automatically.
Webhook ID fallback
The effective webhook ID is resolved at construction time:Emisor’s default. Pass 0 to inherit it.
Fields
Identification
Invoice series and number (e.g.
"FACT-2024-001"). Maps to API field NumSerieFactura. Must be unique within the issuer’s NIF.Invoice issue date in
YYYY-MM-DD format. Maps to API field FechaExpedicionFactura.Optional free-text external reference for your own internal systems. Maps to API field
RefExterna.Date the underlying operation took place, in
YYYY-MM-DD format. Maps to API field FechaOperacion. Only required when the operation date differs from the issue date.Free-text description of the invoiced operation. Maps to API field
DescripcionOperacion.Invoice type and correction
Invoice type, from lista L2 (e.g.
"F1" = standard invoice, "F2" = simplified, "R1"–"R5" = rectification types). Both the integer ID and the string code are accepted. Maps to API field TipoFactura.Rectification method, from lista L3 (substitution or difference). Both the integer ID and the string code are accepted. Maps to API field
TipoRectificativa. Required when tipoFactura is a rectification type (R1–R5).Corrected taxable base amount from the original invoice. Maps to API field
BaseRectificada. Used when tipoRectificativa indicates a substitution.Corrected VAT amount from the original invoice. Maps to API field
CuotaRectificada.Corrected equivalence surcharge amount from the original invoice. Maps to API field
CuotaRecargoRectificado.Special flags
Indicates this record corrects a previously rejected registration, from lista L4. Both the integer ID and the string code are accepted. Maps to API field
Subsanacion.Prior rejection flag, from lista L17. Both the integer ID and the string code are accepted. Maps to API field
RechazoPrevio.Marks the invoice as a simplified invoice under Articles 72 and 73, from lista L4. Both the integer ID and the string code are accepted. Maps to API field
FacturaSimplificadaArt7273.Marks the invoice as one without identified recipient under Article 61d, from lista L5. Both the integer ID and the string code are accepted. Maps to API field
FacturaSinIdentifDestArt61d.Flags this as a large-value transaction (macrodato), from lista L14. Both the integer ID and the string code are accepted. Maps to API field
Macrodato.Indicates the invoice was issued by a third party or by the recipient (self-billing), from lista L6. Both the integer ID and the string code are accepted. Maps to API field
EmitidaPorTercODesti. When set, populate the tercero or destinatario object accordingly.Coupon flag, from lista L4. Both the integer ID and the string code are accepted. Maps to API field
Cupon.Totals
Total tax amount for the invoice (sum of all
cuotaRepercutida values across desgloses). Maps to API field CuotaTotal.Total invoice amount including tax (taxable base +
cuotaTotal). Maps to API field ImporteTotal.Webhook
Webhook ID to receive the AEAT submission result notification. Maps to API field
webhook_id. Falls back to the attached Emisor’s webhookID when 0 is passed to the constructor.Getters and Setters
| Method | Description |
|---|---|
getEmisor(): Emisor | Returns the attached Emisor. |
setEmisor(Emisor $v): void | Replaces the Emisor and re-derives IDEmisorFactura and NombreRazonEmisor. |
getDestinatario(): Destinatario | Returns the attached Destinatario. |
setDestinatario(Destinatario $v): void | Replaces the Destinatario. |
getDesglose(): Desglose | Returns the attached Desglose. |
setDesglose(Desglose $v): void | Replaces the Desglose. |
getTercero(): Tercero | Returns the attached Tercero. |
setTercero(Tercero $v): void | Replaces the Tercero. |
getFacturaRectificada(): FacturaRectificada | Returns the FacturaRectificada reference. |
setFacturaRectificada(FacturaRectificada $v): void | Replaces the FacturaRectificada reference. |
getFacturaSustituida(): FacturaSustituida | Returns the FacturaSustituida reference. |
setFacturaSustituida(FacturaSustituida $v): void | Replaces the FacturaSustituida reference. |
getIDEmisorFactuara(): string | Returns the auto-set issuer NIF. |
setIDEmisorFactuara(string $v): void | Overrides the auto-set issuer NIF. |
getNumSerieFactura(): string | Returns the invoice series/number. |
setNumSerieFactura(string $v): void | Sets the invoice series/number. |
getFechaExpedicionFactura(): string | Returns the issue date. |
setFechaExpedicionFactura(string $v): void | Sets the issue date. |
getRefExterna(): string | Returns the external reference. |
setRefExterna(string $v): void | Sets the external reference. |
getTipoFactura(): int|string | Returns the invoice type (lista L2). |
setTipoFactura(int|string $v): void | Sets the invoice type (lista L2). |
getSubsanacion(): int|string | Returns the correction flag (lista L4). |
setSubsanacion(int|string $v): void | Sets the correction flag (lista L4). |
getRechazoPrevio(): int|string | Returns the prior rejection flag (lista L17). |
setRechazoPrevio(int|string $v): void | Sets the prior rejection flag (lista L17). |
getTipoRectificativa(): int|string | Returns the rectification method (lista L3). |
setTipoRectificativa(int|string $v): void | Sets the rectification method (lista L3). |
getBaseRectificada(): float | Returns the corrected taxable base. |
setBaseRectificada(float $v): void | Sets the corrected taxable base. |
getCuotaRectificada(): float | Returns the corrected VAT amount. |
setCuotaRectificada(float $v): void | Sets the corrected VAT amount. |
getCuotaRecargoRectificado(): float | Returns the corrected surcharge amount. |
setCuotaRecargoRectificado(float $v): void | Sets the corrected surcharge amount. |
getFacturaSimplificadaArt7273(): int\|string | Returns the simplified invoice flag (lista L4). |
| setFacturaSimplificadaArt7273(int\|string $v): void | Sets the simplified invoice flag (lista L4). |
| getFacturaSinIdentifDestinatarioArt61d(): int\|string | Returns the no-recipient-ID flag (lista L5). |
| setFacturaSinIdentifDestinatarioArt61d(int\|string $v): void | Sets the no-recipient-ID flag (lista L5). |
| getMacrodato(): int\|string | Returns the large transaction flag (lista L14). |
| setMacrodato(int\|string $v): void | Sets the large transaction flag (lista L14). |
| getEmitidaPorTercODestinatario(): int\|string | Returns the third-party/recipient issuance flag (lista L6). |
| setEmitidaPorTercODestinatario(int\|string $v): void | Sets the third-party/recipient issuance flag (lista L6). |
| getCupon(): int\|string | Returns the coupon flag (lista L4). |
| setCupon(int\|string $v): void | Sets the coupon flag (lista L4). |
| getCuotaTotal(): float | Returns the total tax amount. |
| setCuotaTotal(float $v): void | Sets the total tax amount. |
| getImporteTotal(): float | Returns the total invoice amount. |
| setImporteTotal(float $v): void | Sets the total invoice amount. |
| getWebhookID(): int | Returns the effective webhook ID. |
| setWebhookID(int $v): void | Overrides the webhook ID. |
getArrayData()
getArrayData(): array assembles the full API-ready payload. Only non-empty scalar fields are included. Sub-models are embedded under their own keys when their own getArrayData() returns a non-empty array:
| Sub-model property | Embedded under key |
|---|---|
destinatario | Destinatarios (single-element array) |
desglose | Desglose (single-element array) |
tercero | Tercero (single-element array) |
facturaRectificada | FacturasRectificadas (single-element array) |
facturaSustituida | FacturasSustituidas (single-element array) |
| PHP property | API field key |
|---|---|
IDEmisorFactuara | IDEmisorFactura |
numSerieFactura | NumSerieFactura |
fechaExpedicionFactura | FechaExpedicionFactura |
refExterna | RefExterna |
nombreRazonEmisor | NombreRazonEmisor |
subsanacion | Subsanacion |
rechazoPrevio | RechazoPrevio |
tipoFactura | TipoFactura |
tipoRectificativa | TipoRectificativa |
baseRectificada | BaseRectificada |
cuotaRectificada | CuotaRectificada |
cuotaRecargoRectificado | CuotaRecargoRectificado |
fechaOperacion | FechaOperacion |
descripcionOperacion | DescripcionOperacion |
facturaSimplificadaArt7273 | FacturaSimplificadaArt7273 |
facturaSinIdentifDestinatarioArt61d | FacturaSinIdentifDestArt61d |
macrodato | Macrodato |
emitidaPorTercODestinatario | EmitidaPorTercODesti |
cupon | Cupon |
cuotaTotal | CuotaTotal |
importeTotal | ImporteTotal |
webhookID | webhook_id |
empty()
RegistroAlta::empty(): RegistroAlta returns a RegistroAlta with all sub-models set to their respective ::empty() instances, all string fields set to '', all integer and flag fields set to 0, and all float fields set to 0.0. Use it as a safe placeholder or as a base for incremental construction in tests.

