Skip to content

HaciendaConsultarEstado

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.

FieldTypeRequiredDescription
credentials_idcredentialsYesHacienda credential
clavetextYesNumeric key (50 digits) of the document

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
{
"clave": "50601012600310123456700100001010000000001100000001",
"estado": "accepted",
"indEstado": "aceptado",
"detalle": "Comprobante aceptado",
"respuestaXml": "...",
"enProceso": false
}
{
"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.