Skip to main content

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.

The Desglose model carries the line-level tax breakdown for an invoice. It records the applicable tax type (VAT or IGIC), the fiscal regime, the operation classification, taxable base amounts, the tax rate, the resulting VAT amount, and any equivalence surcharge. A Desglose instance is passed into RegistroAlta via its objects array. Multiple desgloses per invoice are not directly supported by the model; create separate RegistroAlta entries if your invoice spans multiple tax lines.

Construction

use verifactuPHP\Models\Desglose;

$desglose = new Desglose([
    'impuesto'                      => 1,     // lista L1 — IVA
    'claveRegimen'                  => 1,     // lista L8A — régimen general
    'calificacionOperacion'         => 1,     // lista L9
    'tipoImpositivo'                => 21.0,
    'baseImponibleOImporteNoSujeto' => 1000.00,
    'cuotaRepercutida'              => 210.00,
]);
For IGIC invoices (Canary Islands), use claveRegimenIGIC (lista L8B) instead of claveRegimen. Both fields can be present in the constructor array; only non-zero values are forwarded to the API.

Fields

impuesto
int|string
Tax type applied to this breakdown line, from lista L1 (e.g. 1 = IVA, 2 = IGIC). Both the integer ID and the string code are accepted. Maps to API field Impuesto.
claveRegimen
int|string
VAT fiscal regime key, from lista L8A (e.g. 1 = régimen general). Both the integer ID and the string code are accepted. Maps to API field ClaveRegimen. Use for peninsular VAT operations.
claveRegimenIGIC
int|string
IGIC fiscal regime key, from lista L8B. Both the integer ID and the string code are accepted. Maps to API field ClaveRegimenIGIC. Use for Canary Islands IGIC operations instead of claveRegimen.
calificacionOperacion
int|string
Operation classification, from lista L9 (e.g. subject, exempt, non-subject). Both the integer ID and the string code are accepted. Maps to API field CalificacionOperacion.
operacionExenta
int|string
Exempt operation type, from lista L10. Both the integer ID and the string code are accepted. Maps to API field OperacionExenta. Only required when the operation is classified as exempt.
tipoImpositivo
float
Tax rate percentage applied to the taxable base (e.g. 21.0 for 21 % VAT). Maps to API field TipoImpositivo.
baseImponibleOImporteNoSujeto
float
Taxable base amount, or the non-subject amount when the operation is not subject to tax. Maps to API field BaseImponibleOImporteNoSujeto.
baseImponibleACoste
float
Cost-based taxable base. Used for specific regime operations where the taxable base is calculated at cost. Maps to API field BaseImponibleACoste.
cuotaRepercutida
float
VAT amount charged to the recipient (base × rate / 100). Maps to API field CuotaRepercutida.
tipoRecargoEquivalencia
float
Equivalence surcharge rate percentage, applicable under the recargo de equivalencia special regime. Maps to API field TipoRecargoEquivalencia.
cuotaRecargoEquivalencia
float
Equivalence surcharge amount (base × surcharge rate / 100). Maps to API field CuotaRecargoEquivalencia.

Getters and Setters

MethodDescription
getImpuesto(): int|stringReturns the tax type (lista L1).
setImpuesto(int|string $v): voidSets the tax type (lista L1).
getClaveRegimen(): int|stringReturns the VAT regime key (lista L8A).
setClaveRegimen(int|string $v): voidSets the VAT regime key (lista L8A).
getClaveRegimenIGIC(): int|stringReturns the IGIC regime key (lista L8B).
setClaveRegimenIGIC(int|string $v): voidSets the IGIC regime key (lista L8B).
getCalificacionOperacion(): int|stringReturns the operation classification (lista L9).
setCalificacionOperacion(int|string $v): voidSets the operation classification (lista L9).
getOperacionExenta(): int|stringReturns the exempt operation type (lista L10).
setOperacionExenta(int|string $v): voidSets the exempt operation type (lista L10).
getTipoImpositivo(): floatReturns the tax rate percentage.
setTipoImpositivo(float $v): voidSets the tax rate percentage.
getBaseImponibleOImporteNoSujeto(): floatReturns the taxable base or non-subject amount.
setBaseImponibleOImporteNoSujeto(float $v): voidSets the taxable base or non-subject amount.
getBaseImponibleACoste(): floatReturns the cost-based taxable base.
setBaseImponibleACoste(float $v): voidSets the cost-based taxable base.
getCuotaRepercutida(): floatReturns the VAT amount charged.
setCuotaRepercutida(float $v): voidSets the VAT amount charged.
getTipoRecargoEquivalencia(): floatReturns the equivalence surcharge rate.
setTipoRecargoEquivalencia(float $v): voidSets the equivalence surcharge rate.
getCuotaRecargoEquivalencia(): floatReturns the equivalence surcharge amount.
setCuotaRecargoEquivalencia(float $v): voidSets the equivalence surcharge amount.

getArrayData()

getArrayData(): array returns an associative array containing only non-zero fields, ready for embedding inside the Desglose key of the RegistroAlta payload. PHP property names differ from the API field names used in the payload:
PHP propertyAPI field key
impuestoImpuesto
claveRegimenClaveRegimen
claveRegimenIGICClaveRegimenIGIC
calificacionOperacionCalificacionOperacion
operacionExentaOperacionExenta
tipoImpositivoTipoImpositivo
baseImponibleOImporteNoSujetoBaseImponibleOImporteNoSujeto
baseImponibleACosteBaseImponibleACoste
cuotaRepercutidaCuotaRepercutida
tipoRecargoEquivalenciaTipoRecargoEquivalencia
cuotaRecargoEquivalenciaCuotaRecargoEquivalencia
$data = $desglose->getArrayData();
// Example output:
// [
//     'Impuesto'                      => 1,
//     'ClaveRegimen'                  => 1,
//     'TipoImpositivo'                => 21.0,
//     'BaseImponibleOImporteNoSujeto' => 1000.00,
//     'CuotaRepercutida'              => 210.00,
// ]
RegistroAlta::getArrayData() wraps the result in a single-element array under the key Desglose, matching the API’s expected structure.

empty()

Desglose::empty(): Desglose returns a Desglose with all integer fields set to 0 and all float fields set to 0.0. Because getArrayData() skips zero values, an empty Desglose produces no output in the API payload. Use it as a safe no-op placeholder in RegistroAlta when no tax breakdown is required.
$placeholder = Desglose::empty();

Build docs developers (and LLMs) love