MhAnular
Description
Section titled “Description”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.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | mh credential (key, NIT and Hacienda API) |
| codigo_generacion | text | Yes | Generation Code of the DTE to cancel |
| motivo | textarea | Yes | Cancellation reason |
Credentials
Section titled “Credentials”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
Output
Section titled “Output”{ "success": true, "codigoGeneracion": "A1B2C3D4-E5F6-1234-5678-9ABCDEF01234", "codigoGeneracionEvento": "F9E8D7C6-B5A4-1234-5678-9ABCDEF98765", "estado": "PROCESADO", "fhProcesamiento": "05/08/2026 12:40:05"}Usage Example
Section titled “Usage Example”{ "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_generacionmust correspond to a DTE that was previouslyPROCESADO; a rejected or non-existent document cannot be cancelled.- The invalidation event is signed with the same JWS (RS512) scheme as the original DTE.
motivois 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.
Related Nodes
Section titled “Related Nodes”- MhEmitirFactura - Issue the invoice that could later be cancelled
- MhEmitirComprobante - Issue the Tax Credit Voucher or Note that could later be cancelled