Optional NombreRazon and NIF of SII payload
As specified in Excel Functional blocks, the Contraparte>NombreRazon
(excel: L42) and Contraparte>NIF
(excel: L44) are Obligatorio en recibidas, opcional en emitidas para F2, F4 y R5
/ Required for in invoices, optional on out invoices for types f2, f4 and r5
.
We are sending each of them if we have it, but I found the following rejection from the service: Codigo[4102].El XML no cumple el esquema. Falta informar campo obligatorio.: NIF
when sending this payload of a simplified invoice (no tax identifier, f2):
{'FacturaExpedida': {'ClaveRegimenEspecialOTrascendencia': '01',
'Contraparte': {'NombreRazon': 'BBBBBBBBBBB'},
'DescripcionOperacion': '.',
'ImporteTotal': '250.65',
'RefExterna': 'F2025/0082',
'TipoDesglose': {'DesgloseTipoOperacion': {'Entrega': {'Sujeta': [{'NoExenta': {'DesgloseIVA': {'DetalleIVA': [{'BaseImponible': Decimal('225.00'),
'CuotaRecargoEquivalencia': Decimal('3.15'),
'CuotaRepercutida': Decimal('22.50'),
'TipoImpositivo': '10.0',
'TipoRecargoEquivalencia': '1.4'}]},
'TipoNoExenta': 'S1'}}]}}},
'TipoFactura': 'F2'},
'IDFactura': {'FechaExpedicionFacturaEmisor': '21-01-2025',
'IDEmisorFactura': {'NIF': 'AAAAAAAAAAA'},
'NumSerieFacturaEmisor': 'F2025/0082'},
'PeriodoLiquidacion': {'Ejercicio': '2025', 'Periodo': '01'}}
As you can see, no there is no NIF for the customer as it's a simplified invoice (f2) but we send the name as we have it. Seams that as they detect one field (NombreRazon) they made the other field (NIF) required when it should not as it's a F2 invoice.
As there's no clarification about this specific scenario, and they're optional, the best is to not send a Contraparte
.
FTR, things tested as alternative solutions that don't work:
- Deleting
NombreRazon
key raisesMissing element NombreRazon
. - Sending an empty string for the keys result in
Valor o tipo incorrecto del campo: NombreRazon
. - Adding a non tax identifier returns
Si el tipo de factura es F2, F4 ó R5, la contraparte no puede estar cumplimentada
.