Skip to content

MhAnular

Invalidates (cancels) an already issued DTE in El Salvador before the Ministry of Finance (Hacienda), identified by its Generation Code. The node builds the corresponding invalidation event, signs it with JWS and sends it to Hacienda.

The other data of the document being cancelled (type, issuer, receiver) is automatically retrieved from the database based on the Generation Code; only the cancellation reason needs to be provided.

FieldTypeRequiredDescription
credentials_idcredentialsYesmh credential (key, NIT and Hacienda API)
codigo_generaciontextYesGeneration Code of the DTE to cancel
motivotextareaYesCancellation reason

This module requires an mh credential type with the following fields:

  • Issuer NIT / NRC: taxpayer tax identification
  • Hacienda API user and password: credentials used to obtain the authentication token
  • Signing certificate: material used to sign the invalidation event with JWS (RS512)
  • Environment: test or production, according to Hacienda’s configured environment
{
"success": true,
"codigoGeneracion": "A1B2C3D4-E5F6-1234-5678-9ABCDEF01234",
"codigoGeneracionEvento": "F9E8D7C6-B5A4-1234-5678-9ABCDEF98765",
"estado": "PROCESADO",
"fhProcesamiento": "05/08/2026 12:40:05"
}
{
"credentials_id": "cred-mh-prod",
"codigo_generacion": "A1B2C3D4-E5F6-1234-5678-9ABCDEF01234",
"motivo": "Error in the recipient's data, a new document is being issued"
}
  • codigo_generacion must correspond to a DTE that was previously PROCESADO; a rejected or non-existent document cannot be cancelled.
  • The invalidation event is signed with the same JWS (RS512) scheme as the original DTE.
  • motivo is required: Hacienda demands a text justification for the cancellation.
  • Hacienda enforces deadlines and conditions for invalidating a DTE (for example, based on time elapsed since issuance); if the document is no longer cancellable, the node returns Hacienda’s corresponding error.