HaciendaEmitirNota
Description
Section titled “Description”Issues a Credit Note (type 03) or a Debit Note (type 02) to Costa Rica’s Ministerio de Hacienda. The node requires a reference to the original document (the numeric key of the document being corrected or voided), builds the XML, signs it and runs the same reception and status-query flow as the invoice.
Like the invoice, the note only becomes tax-valid once Hacienda ACCEPTS it.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Hacienda credential |
| nota | json | No | Note in JSON: tipo (03 credit, 02 debit), receptor, items, referencia {clave, tipoDoc, fecha, codigo, razon} of the original document. If left empty, the input data from the previous node is used. |
Credentials
Section titled “Credentials”This module requires a hacienda credential type with the following fields:
- Certificate (.p12): the issuer’s digital certificate
- Certificate password
- Issuer’s cedula/tax ID (9 to 12 digits)
- ATV user and password (Hacienda’s IDP)
- Environment: sandbox (testing) or production
Output
Section titled “Output”{ "clave": "50601012600310123456700200001010000000002100000001", "tipo": "03", "estado": "accepted", "indEstado": "aceptado", "enProceso": false, "referencia": { "clave": "50601012600310123456700100001010000000001100000001", "tipoDoc": "01" }, "total": 113, "detalle": "Comprobante aceptado", "xml": "..."}Usage Example
Section titled “Usage Example”{ "credentials_id": "cred-hacienda-prod", "nota": { "tipo": "03", "receptor": { "cedula": "3101123456", "tipoCedula": "02", "nombre": "Cliente SA" }, "items": [ { "descripcion": "Consulting service", "cantidad": 1, "precioUnitario": 100, "codigoTarifa": "08" } ], "referencia": { "clave": "50601012600310123456700100001010000000001100000001", "tipoDoc": "01", "fecha": "2026-08-01", "codigo": "01", "razon": "Voided due to an amount error" } }}- The note requires the reference (the original document’s key); without it, the node returns an error before building the XML.
- Type 03 (credit) is the most common one, used to void or correct invoices; type 02 (debit) is used for additional charges on an already-issued document.
- Just like the invoice, the signed XML is persisted before sending, and the status is reconciled with HaciendaConsultarEstado if it comes back in process.
Related Nodes
Section titled “Related Nodes”- HaciendaEmitirFactura - Issue the original invoice
- HaciendaConsultarEstado - Query the document’s status
- HaciendaRepresentacion - Generate the printable representation with QR