HaciendaConsultarEstado
Description
Section titled “Description”Queries the status of an electronic document at Costa Rica’s Ministerio de Hacienda, using its 50-digit numeric key. This is the node to use to reconcile documents that came back received or processing after being issued, or to verify the real status before generating the printable representation. The node updates the document’s status in the database when it receives the response.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | Hacienda credential |
| clave | text | Yes | Numeric key (50 digits) of the document |
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": "50601012600310123456700100001010000000001100000001", "estado": "accepted", "indEstado": "aceptado", "detalle": "Comprobante aceptado", "respuestaXml": "...", "enProceso": false}Usage Example
Section titled “Usage Example”{ "credentials_id": "cred-hacienda-prod", "clave": "50601012600310123456700100001010000000001100000001"}- If the key does not have exactly 50 digits, the node returns an error before querying Hacienda.
- While enProceso is true (indEstado received or processing) it is best to retry the query later, for example with a wait node or a short cron.
- The result also updates the document’s record saved when it was issued, if the node finds the key in the database.
Related Nodes
Section titled “Related Nodes”- HaciendaEmitirFactura - Issue the invoice
- HaciendaEmitirNota - Issue a credit or debit note
- HaciendaRepresentacion - Generate the printable representation with QR