Costa Rica Hacienda 4.4
Costa Rica Ministerio de Hacienda comprobante electronico v4.4 (FE/TE/NC/ND/REP) with Clave, cedula validation, QR and BYOK clearance to the Hacienda recepcion API
Costa Rica Hacienda 4.4 e-Invoicing
Comprobante electronico v4.4 — FE, TE, NC, ND, REP — with Clave, cedula validation, QR and BYOK clearance
Generate, validate, sign and clear the electronic comprobantes required by the Ministerio de Hacienda de Costa Rica, implementing the v4.4 comprobante electronico schema published at cdn.comprobanteselectronicos.go.cr. Built on the shared e-Invoice Core Engine, it adds the full Costa Rica format, numbering and clearance flow. Compatible with Odoo 18, Odoo 19 and Odoo 20.
All Five Document Families
Factura Electronica (FE), Tiquete Electronico (TE), Nota de Credito (NC), Nota de Debito (ND) and Recibo Electronico de Pago (REP), each built in the exact element order of the Hacienda v4.4 XSD sequence.
50-digit Clave Generator
Country + emission date + 12-digit emitter cedula + 20-digit consecutivo (sucursal / terminal / tipoDoc / numero) + situacion + 8-digit security code, with a verifiable mod-11 self-check.
Real Cedula Validation
Enforces the official type-to-length matrix: Cedula Fisica (9), Juridica (10), DIMEX (11/12), NITE (10) and foreign identification — on the company and on every partner.
CABYS from the Product, Never Guessed
Every product carries its own CABYS Code field (13
characters, from the official catalogue), and that is the value
emitted as CodigoCABYS on each line. A product with
no code blocks generation with a message naming it,
instead of falling back to a catch-all code: Hacienda validates
only the length of the code, so a wrong one is accepted
and silently files the sale under the wrong classification.
A company-wide default code exists but is off by default.
IVA Tariffs and Totals
Per-line IVA with the Hacienda tariff code, taken from the complete official CodigoTarifaIVA table (01 to 11, Nota 8.1 of the Hacienda Anexos): 13%, 4%, 2%, 1% and 0.5% follow from the rate, and a zero rate states its own code on the tax card, because Hacienda gives zero four different codes that are not interchangeable. A rate with no official code is refused rather than filed under the nearest one — Hacienda validates the code against a list only, so a wrong-but-listed code comes back accepted and the misstatement is never reported. ResumenFactura totals coherence (TotalComprobante = TotalVentaNeta + TotalImpuesto) is checked before the document is generated.
BYOK Hacienda Clearance
Submit signed comprobantes to the Hacienda recepcion API and poll the acceptance response. All five clearance states Hacienda documents — recibido, procesando, aceptado, rechazado and error — are recorded separately, so an invoice still sitting in Hacienda's queue no longer reads simply "Sent". Official sandbox and production endpoints are pre-filled as editable defaults. Your Hacienda credentials and e-seal certificate stay on your own database.
Verification QR & Onboarding
A QR linking to the Hacienda comprobante consultation page, a guided setup wizard, invoice Generate / Submit / Check-Status buttons, and a clearance-status polling cron that is enabled on installation and backs off on its own when Hacienda cannot see a Clave yet.
How It Works
- Run the Costa Rica setup wizard: identification, economic activity and Hacienda API credentials (BYOK).
- Post a customer invoice or credit note as usual.
- Generate the v4.4 comprobante — the Clave, consecutivo and QR are computed and validated.
- Submit to Hacienda; the module polls for the acceptance response every 30 minutes and records which of the five official clearance states came back.
- If it is rejected, read the reason on the invoice itself: the DetalleMensaje of the signed MensajeHacienda is decoded and shown as text, and the signed answer is kept as an attachment.
Disclosure: this module transmits invoice data only to the Hacienda recepcion endpoint you configure. No data is sent anywhere else, and your credentials and certificate / private key never leave your database.
Supports Odoo 18, Odoo 19 and Odoo 20. License OPL-1.
Screenshots
Posted Factura Electronica W
Generated V4 4 Comprobante D
Validated Against the Official Schemas
The Ministerio de Hacienda v4.4 XSD files ship inside the module
(static/xsd/, unmodified, with their download URLs
and checksums recorded). The automated test suite validates the
generated FE, TE, NC, ND and REP XML against those schemas with
lxml.etree.XMLSchema — including the fact that
a Recibo Electronico de Pago has its own, different body. Schema
conformance is therefore measured on every test run, not
asserted.
Update date: 2026-08-30
User guides (PDF)
Related modules
Costa Rica REP v4.4
Costa Rica Recibo Electronico de Pago (REP) v4.4 for received payments on credit invoices, with Clave, MedioPago allocation, InformacionReferencia, QR and BYOK clearance to Hacienda
Costa Rica v4.4 In
Costa Rica inbound: receive supplier comprobantes v4.4 and answer with the MensajeReceptor (acceptance / partial / rejection) over the Hacienda recepcion API (BYOK)
Costa Rica Holidays
Calendario completo de 10 años de días festivos de Costa Rica, listo para Odoo HR. Festivos nacionales y religiosos - aplicados automáticamente al resource.calendar como ausencias.