Skip to main content
The Tax enum represents all tax types supported by the FacturaE 3.2.2 XSD specification. Each tax type has a unique code used in the XML output.

Enum Cases

The following table lists all 29 tax types available:
CaseCodeDescription
IVA01Impuesto sobre el Valor Añadido (VAT)
IPSI02Impuesto sobre la Producción, los Servicios y la Importación
IGIC03Impuesto General Indirecto Canario
IRPF04Impuesto sobre la Renta de las Personas Físicas (withheld by default)
Other05Other taxes
ITPAJD06Impuesto sobre Transmisiones Patrimoniales y Actos Jurídicos Documentados
IE07Impuestos Especiales
RA08Renta Aduanas
IGTECM09Impuesto General sobre el Tráfico de Empresas (Ceuta/Melilla)
IECDPCAC10Impuesto Especial sobre Combustibles Derivados del Petróleo (Ceuta/Melilla)
IIIMAB11Impuesto sobre las Instalaciones que inciden en el Medio Ambiente (Baleares)
ICIO12Impuesto sobre Construcciones, Instalaciones y Obras
IMVDN13Impuesto Municipal sobre Viviendas Desocupadas (Navarra)
IMSN14Impuesto Municipal sobre Solares (Navarra)
IMGSN15Impuesto Municipal sobre Gastos Suntuarios (Navarra)
IMPN16Impuesto Municipal sobre Publicidad (Navarra)
REIVA17Régimen Especial de IVA
REIGIC18Régimen Especial de IGIC
REIPSI19Régimen Especial de IPSI
IPS20Impuesto sobre las Primas de Seguros
RLEA21Recargo de Equivalencia de IVA
IVPEE22Impuesto sobre el Valor de la Producción de Energía Eléctrica
IPCNG23Impuesto sobre la Producción de Combustible Nuclear Gastado
IACNG24Impuesto sobre el Almacenamiento de Combustible Nuclear Gastado
IDEC25Impuesto sobre los Depósitos en las Entidades de Crédito
ILTCAC26Impuesto sobre los Gases Fluorados de Efecto Invernadero
IGFEI27Impuesto sobre los Gases Fluorados de Efecto Invernadero
IRNR28Impuesto sobre la Renta de No Residentes (withheld by default)
ISS29Impuesto sobre las Sociedades

Methods

isWithheldByDefault()

Determines if a tax is withheld by default (retained at source). This can be overridden using the isWithholding parameter in TaxBreakdown.
public function isWithheldByDefault(): bool
Returns true for:
  • Tax::IRPF - Income tax withheld from individuals
  • Tax::IRNR - Non-resident income tax
All other tax types return false.

Usage Examples

Basic Tax Usage

use PhpFacturae\Enums\Tax;

// Add IVA (VAT) at 21%
$invoice->addItem(
    name: 'Web Development Services',
    quantity: 10,
    price: 100.00,
    tax: Tax::IVA,
    taxRate: 21.0
);

Withholding Tax (IRPF)

use PhpFacturae\Enums\Tax;

// IRPF is withheld by default
$invoice->addItem(
    name: 'Professional Services',
    quantity: 1,
    price: 1000.00,
    tax: Tax::IRPF,
    taxRate: 15.0
);

// Check if tax is withheld
if (Tax::IRPF->isWithheldByDefault()) {
    echo 'This tax will be withheld';
}

Canary Islands Tax (IGIC)

use PhpFacturae\Enums\Tax;

// Use IGIC for Canary Islands instead of IVA
$invoice->addItem(
    name: 'Product',
    quantity: 5,
    price: 50.00,
    tax: Tax::IGIC,
    taxRate: 7.0
);

Multiple Tax Types

use PhpFacturae\Enums\Tax;

// Item with IVA
$invoice->addItem(
    name: 'Product A',
    quantity: 1,
    price: 100.00,
    tax: Tax::IVA,
    taxRate: 21.0
);

// Service with IRPF withholding
$invoice->addItem(
    name: 'Consulting Service',
    quantity: 1,
    price: 500.00,
    tax: Tax::IRPF,
    taxRate: 15.0
);

Notes

  • The most commonly used tax type in Spain is IVA (VAT)
  • Standard IVA rates are 21% (general), 10% (reduced), and 4% (super-reduced)
  • IRPF and IRNR are withholding taxes that reduce the amount paid to the supplier
  • Canary Islands use IGIC instead of IVA
  • Ceuta and Melilla use IPSI instead of IVA
  • The tax code values are defined by the Spanish Tax Agency (AEAT)

See Also

Build docs developers (and LLMs) love