Rectify invoice (Veri*factu)
rectify_invoiceCreate a rectificativa (factura rectificativa / abono / corrección) for a finalized invoice. This is a Veri*factu chain operation. Ask the user for explicit confirmation first, then call with confirm=true. It creates a DRAFT rectificativa that you review and finalize afterwards. Use negative amounts for a full credit. Returns the new rectificativa draft's id (and number, if already assigned).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | ||
| notes | No | ||
| confirm | Yes | Must be true. Only after the user explicitly confirmed. | |
| tax_rate | No | ||
| invoice_id | Yes | ||
| base_rectificada | No | Taxable base of the ORIGINAL invoice. Required when rectification_mode is S. | |
| cuota_rectificada | No | Tax amount of the ORIGINAL invoice. Required when rectification_mode is S. | |
| rectification_mode | No | I = por diferencias (only the delta), S = por sustitución (replaces the original). With S you MUST also pass base_rectificada and cuota_rectificada. | I |
| rectification_type | No | AEAT reason class, goes into the Veri*factu record as given. R1 = art. 80.1/80.2/80.6 LIVA (the usual error case), R2 = art. 80.3 (insolvency), R3 = art. 80.4 (bad debt), R4 = other, R5 = corrective for a simplified invoice. Ask the user which case applies; do not infer it. | R1 |
| rectification_reason_code | No | Only needed when the customer is a Spanish public administration (Facturae/FACe). Facturae has its OWN reason list, different from Veri*factu's R1-R5: 01-16 for formal errors, 80-85 for Art. 80 LIVA cases. Ask the user which applies, do not infer it. |