Skip to content

MhEmitirFactura

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%.

FieldTypeRequiredDescription
credentials_idcredentialsYesmh credential (key, NIT and Hacienda API)
dtejsonNoInvoice 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.

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
{
"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"
}
{
"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 PROCESADO status and delivers the Reception Seal; a signed but rejected DTE has no tax validity.
  • The invoice items’ precioUnitario includes VAT (13%), unlike the Tax Credit Voucher where VAT is broken out as a separate tribute.
  • The returned codigoGeneracion is the identifier needed for a later cancellation with MhAnular.