DIAN
Colombian DIAN Electronic Invoicing (Facturación Electrónica DIAN Anexo Técnico 1.9, Resolución 000165) plugin for Medusa v2: UBL 2.1 XML, CUFE/CUDE SHA-384, XAdES-EPES digital signature, DIAN SOAP Web Services & Pluggable Providers (Siigo, Alegra, Dataic
- Category
- ERP
- Built by
- Vicacha-devs
- Version
- 0.1.1
- Monthly downloads
- Loading downloads
- Last updated
Colombian DIAN Electronic Invoicing (Facturación Electrónica DIAN — Anexo Técnico 1.9 & Resolución 000165) plugin for Medusa v2.
Supports both Native "Software Propio" transmission (UBL 2.1 XML, SHA-384 CUFE/CUDE, XAdES-EPES digital signature, DIAN SOAP Web Services, and RADIAN events) and Pluggable Colombian Proveedores Tecnológicos / ERPs (, , , ).
Medusa compatibility: Required core plugin: — acts as the Colombia ( / ) fiscal driver () for .
Contents
- Key Features
- Ecosystem & Legal Invariants
- Installation & Configuration
- Architecture
- Data Models ( Module)
- Workflows
- REST API
- Admin UI & Widgets
- Development & Testing
- License
Key Features
- Hybrid Transmission Engine:
- Native "Software Propio" (): Generates compliant UBL 2.1 XML (, , , ), computes CUFE / CUDE (), signs XML with XAdES-EPES (PKCS#12 /), and communicates with DIAN Web Services (, , , , ).
- Pluggable Provider Adapter (): Built-in adapters for Siigo, Alegra, Dataico, and FacturaTech.
- Complete DIAN Document Suite:
- Factura Electrónica de Venta ( Nacional, Exportación, Contingencia) with CUFE.
- Nota Crédito Electrónica () & Nota Débito Electrónica () with CUDE and mandatory to the original invoice CUFE.
- Documento Equivalente Electrónico POS ( — Tiquete POS Electrónico, Resolución 000165) with CUDE and 80mm/58mm thermal QR representation.
- RADIAN Events (, , , , ) for title-value (Título Valor) lifecycle tracking.
- Colombian Tax & Modulo-11 Engine:
- DIAN Modulo-11 check digit () with prime weights .
- Automatic separation of taxes (, , ) and Colombian withholdings (Retenciones: , , ).
- Formulario 1876 numbering resolution validation (expiry date, range exhaustion, and low-folio alerts).
Ecosystem & Legal Invariants
- Named Electronic Invoice Requires a Registered Client:
- Any buyer requesting a named Electronic Invoice ( or non- identification) must be a registered Medusa () with both a valid email () and phone ().
- Anonymous buyers automatically default to Consumidor Final (, , ).
- Legal Client () Requires :
- Registering or invoicing a Legal Client (Persona Jurídica / NIT + Modulo-11 DV) strictly requires ( module) and a valid .
- PDF Generation (Representación Gráfica) Requires :
- Generating the Representación Gráfica PDF (A4 Invoice, Credit/Debit Note, or 80mm/58mm POS Receipt with DIAN QR code, CUFE/CUDE, Resolution 1876 text, NIT+DV, and Retenciones) strictly delegates to ( module).
Installation & Configuration
Register in :
Run database migrations:
npx medusa db:migrateArchitecture
Data Models ( Module)
| Model | Description |
|---|---|
| Emisor (Obligado a Facturar Electrónicamente — OFE) NIT, DV, Software ID/PIN, Clave Técnica, Ambiente ( Producción / Habilitación), XAdES certificate, and provider credentials. | |
| Formulario 1876 authorization numbers, prefix (, , , , ), range ( – ), , and validity dates. | |
| Emitted electronic documents (, , , , , ), , status (, , , ), UBL XML, XML, PDF URL, and RADIAN status. | |
| Buyer fiscal identity (, , , , , , , ). |
Workflows
| Workflow ID | Description |
|---|---|
| Emits an Electronic Invoice ( / / ) with atomic folio reservation and rollback compensation | |
| Emits a Nota Crédito () referencing the original invoice's CUFE | |
| Emits a Nota Débito () referencing the original invoice's CUFE | |
| Emits a Documento Equivalente POS ( — Resolución 000165) | |
| Emits a RADIAN event (–) on a validated invoice | |
| Validates NIT Modulo-11 DV and B2B Legal Client link before upserting a fiscal profile |
REST API
Admin Routes ()
| Method | Path | Description |
|---|---|---|
| / | Retrieve or update Emisor OFE configuration (redacts secrets on ) | |
| / | List or create Formulario 1876 numbering resolutions | |
| Synchronize active resolutions from DIAN SOAP service | ||
| / | Update or delete a numbering resolution | |
| / | List electronic documents (with KPI summary) or emit a new Invoice / POS document | |
| Retrieve document details | ||
| Emit a Nota Crédito () against a validated invoice | ||
| Emit a Nota Débito () against a validated invoice | ||
| Register a RADIAN event (–) | ||
| Retry transmission of a rejected/contingency document | ||
| Download signed UBL 2.1 XML or | ||
| Generate/download Representación Gráfica PDF via | ||
| Download DIAN-compliant ( containing + ) | ||
| / | List or upsert Customer & B2B Legal Client fiscal profiles |
Store Routes ()
| Method | Path | Description |
|---|---|---|
| Computes Modulo-11 DV and optionally queries DIAN | ||
| / | Read or attach Colombian fiscal profile data to a checkout cart | |
| Retrieve validated electronic documents (, , ) for an order |
Admin UI & Widgets
- (): Overview KPI cards () + Electronic Documents table ().
- (): Formulario 1876 Numbering Resolutions () + DIAN SOAP sync.
- (): Client & B2B Legal Client fiscal profiles ().
- (): Emisor OFE configuration () + Tax & Retenciones automation ().
- Widget (): Order-level DIAN emission, Credit Note modal, and XML/PDF/ZIP downloads ().
Development & Testing
License
MIT © Vicacha Devs

