MhEmitirFactura
Description
Section titled “Description”Issues an electronic invoice (DTE, Documento Tributario Electronico) to El Salvador’s Ministry of Finance (Hacienda). Unlike most countries in the region, the Salvadoran DTE is built in JSON, not XML. The node builds the document, digitally signs it with JWS (RS512 algorithm), obtains the authentication token and performs the reception POST against Hacienda’s services.
The invoice only becomes valid once Hacienda PROCESSES it and returns the Reception Seal; until then the signed DTE has no tax validity. Issuer data comes from the credential; VAT is calculated at 13%.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | mh credential (key, NIT and Hacienda API) |
| dte | json | No | Invoice as JSON: receptor (tipoDocumento, numDocumento, nombre), items (precioUnitario VAT-included, tipoItem 1 good / 2 service). Optional sequential |
Issuer data (NIT, NRC, trade name, establishment) is automatically filled from the credential when not present in dte.
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 DTE 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", "numeroControl": "DTE-01-00000001-000000000000001", "selloRecibido": "2026080512345678901234567890123456", "estado": "PROCESADO", "fhProcesamiento": "05/08/2026 10:15:32", "dteFirmado": "eyJhbGciOiJSUzUxMiJ9...jwscompact"}Usage Example
Section titled “Usage Example”Invoice with one item taxed at 13%
Section titled “Invoice with one item taxed at 13%”{ "credentials_id": "cred-mh-prod", "dte": { "receptor": { "tipoDocumento": "36", "numDocumento": "06141804941035", "nombre": "Cliente SA de CV" }, "items": [ { "descripcion": "Consulting service", "cantidad": 1, "precioUnitario": 113, "tipoItem": 2 } ] }}- The DTE is built and transmitted as JSON, not XML; the JWS (RS512) signature replaces the XMLDSig scheme used in other countries.
- The invoice only becomes valid once Hacienda responds with
PROCESADOstatus and delivers the Reception Seal; a signed but rejected DTE has no tax validity. - The invoice items’
precioUnitarioincludes VAT (13%), unlike the Tax Credit Voucher where VAT is broken out as a separate tribute. - The returned
codigoGeneracionis the identifier needed for a later cancellation with MhAnular.
Related Nodes
Section titled “Related Nodes”- MhEmitirComprobante - Issue a Tax Credit Voucher or Note
- MhAnular - Cancel an already issued DTE