Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mdiago/VeriFactu/llms.txt

Use this file to discover all available pages before exploring further.

TaxItem represents a single line in the invoice’s tax breakdown (Desglose). Each invoice can carry up to 12 TaxItem instances covering different tax rates, tax schemes (IVA / IGIC / IPSI), operation types, and exemption causes. The collection is assigned to Invoice.TaxItems.

Namespace

VeriFactu.Business

Propiedades

TaxClass
TaxClass
Indicates whether this line represents output tax (IVA, IGIC, IPSI — repercutido) or withheld tax (retención).
ValueDescription
TaxClass.TaxOutputOutput / collected tax (default)
TaxClass.TaxWithheldWithheld / retained tax
The Invoice class uses this value to route amounts into TotalTaxOutput vs. TotalTaxWithheld when calculating totals.
Tax
Impuesto
The applicable tax type. Defaults to IVA if not set.
ValueCodeDescription
Impuesto.IVA01Impuesto sobre el Valor Añadido
Impuesto.IPSI02IPSI (Ceuta y Melilla)
Impuesto.IGIC03IGIC (Canarias)
Impuesto.Otro05Other
TaxScheme
ClaveRegimen
Tax regime key (lists L8A / L8B). Determines the special regime or the standard general regime. Defaults to ClaveRegimen.RegimenGeneral.Common values: RegimenGeneral, RegimenEspecialRecargo, RegimenEspecialBienesUsados, CriterioCaja, etc.
TaxType
CalificacionOperacion
Operation qualification (list L9). Classifies the taxable nature of the line.
ValueMeaning
S1Subject and not exempt — no reverse charge
S2Subject and not exempt — reverse charge
N1Not subject — Article 7, 14, others
N2Not subject — due to rules of localisation
Defaults to S1.
TaxException
CausaExencion
Exemption cause (list L10). Set this when the line is exempt from tax. Defaults to CausaExencion.NA (not exempt).Common values: E1 through E6. When set to anything other than NA, TaxRate, TaxAmount, TaxRateSurcharge, and TaxAmountSurcharge must all be zero — the library enforces this as a validation error.
TaxBase
decimal
Taxable base amount (BaseImponibleOimporteNoSujeto). For exempt or non-subject lines, this holds the exempt/non-subject amount.
TaxRate
decimal
Tax rate as a percentage (e.g. 21 for 21 % IVA). Must be 0 when TaxException is set. Rounded to 2 decimal places when building the XML.
TaxAmount
decimal
Tax amount (CuotaRepercutida). Must be 0 when TaxException is set. Rounded to 2 decimal places when building the XML.
TaxRateSurcharge
decimal
Equivalence surcharge rate (TipoRecargoEquivalencia) as a percentage. Only applicable under RegimenEspecialRecargo. Must be 0 when TaxException is set.
TaxAmountSurcharge
decimal
Equivalence surcharge amount (CuotaRecargoEquivalencia). Only populated in the XML when non-zero. Must be 0 when TaxException is set.

Reglas de negocio

Maximum 12 TaxItem entries per invoice. Exceeding this limit raises a validation error when constructing InvoiceEntry.
Exempt lines: If TaxException is set to any value other than NA, then TaxRate, TaxAmount, TaxRateSurcharge, and TaxAmountSurcharge must all be 0. Violating this rule raises an InvalidOperationException with the message: "Taxitem [...] con TaxException asignada '...' no puede tener un valor distinto de 0 en las propiedades TaxRate, TaxAmount, TaxRateSurcharge y TaxAmountSurcharge."
Non-subject operations (N1 / N2) with IVA: When TaxType is N1 or N2 and Tax is IVA, the XML serialization automatically nullifies TipoImpositivo and CuotaRepercutida (AEAT error 1237 prevention). Ensure TaxRate and TaxAmount are 0 for these lines.

Ejemplo

using VeriFactu.Business;
using VeriFactu.Xml.Factu;
using VeriFactu.Xml.Factu.Alta;

// Standard 21 % IVA line — general regime
var standardLine = new TaxItem
{
    TaxScheme = ClaveRegimen.RegimenGeneral,
    TaxType   = CalificacionOperacion.S1,
    TaxRate   = 21,
    TaxBase   = 1000,
    TaxAmount = 210
};

// Reduced 10 % IVA line
var reducedLine = new TaxItem
{
    TaxScheme = ClaveRegimen.RegimenGeneral,
    TaxType   = CalificacionOperacion.S1,
    TaxRate   = 10,
    TaxBase   = 500,
    TaxAmount = 50
};

// Exempt line — Article 20 LIVA (E1)
var exemptLine = new TaxItem
{
    TaxException = CausaExencion.E1,
    TaxBase      = 750
    // TaxRate, TaxAmount, TaxRateSurcharge, TaxAmountSurcharge must stay at 0
};

// Non-subject line (N1) — no rate or amount fields
var nonSubjectLine = new TaxItem
{
    TaxType = CalificacionOperacion.N1,
    TaxBase = 200
};

// Equivalence surcharge (recargo de equivalencia) — 21 % + 5.2 % surcharge
var surchargeItem = new TaxItem
{
    TaxScheme          = ClaveRegimen.RegimenEspecialRecargo,
    TaxType            = CalificacionOperacion.S1,
    TaxRate            = 21,
    TaxBase            = 1000,
    TaxAmount          = 210,
    TaxRateSurcharge   = 5.2m,
    TaxAmountSurcharge = 52
};

var invoice = new Invoice("FAC-2024-002", new DateTime(2024, 11, 15), "B72877814")
{
    InvoiceType = TipoFactura.F1,
    SellerName  = "MI EMPRESA SL",
    TaxItems    = new List<TaxItem> { standardLine, reducedLine }
};

Build docs developers (and LLMs) love