Overview
CompuTécnicos includes electronic invoicing (facturación electrónica) capabilities compliant with Colombian DIAN regulations. The system integrates with authorized electronic invoicing providers to generate, transmit, and store legally valid invoices.Electronic invoicing is mandatory in Colombia for businesses meeting certain criteria. This feature ensures your e-commerce platform is DIAN-compliant.
Key Features
DIAN Compliance
Meets all Colombian electronic invoicing requirements
Provider Integration
Supports Alegra and Siigo authorized providers
Automatic Generation
Invoices created automatically when orders are paid
PDF Download
Customers can download PDF invoices with CUFE code
Colombian Electronic Invoicing
Legal Requirements
In Colombia, electronic invoices must include:DIAN-Required Elements
DIAN-Required Elements
Supplier Information:
- Legal business name
- NIT (tax identification number)
- Business address
- Economic activity code
- Tax regime
- Full name or business name
- ID number or NIT
- Email address
- Billing address
- Consecutive invoice number
- Invoice date and time
- Currency (COP)
- Payment method
- Payment terms
- Product description
- Quantity
- Unit price
- Tax rate (IVA)
- Line total
- Subtotal
- Total IVA
- Total amount
- CUFE (Código Único de Factura Electrónica)
- QR code with validation URL
- Digital signature
- DIAN authorization number
CUFE Code
The CUFE is a unique identifier for each electronic invoice:- Purpose: Validates invoice authenticity
- Format: 96-character alphanumeric string
- Generation: Created by combining invoice data with cryptographic hash
- Verification: Can be validated on DIAN website
Supported Providers
Alegra
Integration with Alegra’s electronic invoicing platform: Features:- Real-time invoice transmission to DIAN
- Automatic CUFE generation
- PDF invoice generation with watermark
- Invoice status tracking
- Customer portal access
config/factura_config.php:
Siigo
Integration with Siigo’s invoicing system: Features:- Complete accounting integration
- Inventory sync
- Customer management
- Multi-document support (invoices, credit notes)
- Comprehensive reporting
config/factura_config.php:
Both providers are DIAN-authorized and provide the legal guarantees required for electronic invoicing in Colombia.
Invoicing Workflow
Automatic Invoice Generation
Invoices are generated automatically:- Customer places order in the e-commerce platform
- Payment is confirmed via PayPal
- Order status changes to “Pagado” (Paid)
- System triggers invoice generation
- API call sent to configured provider (Alegra/Siigo)
- Invoice is created with CUFE and transmitted to DIAN
- PDF is generated and stored in the system
- Customer receives email with invoice attached
Detailed Invoice Generation Process
Detailed Invoice Generation Process
Step 1: Order Data Collection
- Gather customer information from order
- Collect product details from order items
- Calculate taxes (19% IVA on applicable items)
- Determine payment method from PayPal transaction
- Format data according to provider’s API specifications
- Include authentication credentials
- Send POST request to create invoice
- Receive invoice ID and CUFE from provider
- Provider validates invoice data
- Generates CUFE and QR code
- Transmits to DIAN for approval
- Receives approval confirmation
- PDF invoice downloaded from provider
- Stored in
uploads/facturas/directory - Linked to order in database
- Email sent to customer with PDF attachment
- Invoice available in customer’s order history
Manual Invoice Generation
Administrators can also generate invoices manually:- Navigate to Admin → Pedidos (Orders)
- Select an order in “Pagado” status or later
- Click “Generar Factura” button
- System creates invoice via configured provider
- Invoice is immediately available for download
Simulation Mode
For testing and development:Testing Without API Calls
Testing Without API Calls
Enable Simulation Mode:
In What Happens:Always disable simulation mode before going live!
config/factura_config.php:- No actual API calls to provider
- Simulated CUFE generated (fake but valid format)
- PDF created with “SIMULADO” watermark
- No transmission to DIAN
- Useful for development and testing
Simulated invoices are NOT legally valid and should never be used for real transactions.
Invoice PDF Format
PDF Structure
Generated invoices include: Header:- Company logo
- Company name and NIT
- “FACTURA ELECTRÓNICA DE VENTA” title
- Invoice number and date
- Business address
- Phone and email
- Tax regime information
- Customer name
- ID or NIT
- Billing address
- Item descriptions
- Quantities
- Unit prices
- IVA rates
- Line totals
- Subtotal (before tax)
- IVA amount
- Total to pay
- CUFE code (large font)
- QR code for validation
- DIAN resolution number
- Digital signature information
- Legal disclaimer text
Downloading Invoices
Customers can download invoices: From Order History Page:- Log in to account
- Go to “Mis Pedidos”
- Find the paid order
- Click “Descargar factura” button
- PDF opens in new tab or downloads
- Invoice attached to order confirmation email
- Click attachment to view/download
Tax Calculation
IVA (Value Added Tax)
Standard IVA rate in Colombia: 19%IVA Calculation Details
IVA Calculation Details
Applicable Products:Invoice Totals:Example:
- Most computer hardware: 19% IVA
- Some peripherals: 19% IVA
- Software: May be exempt (0% IVA)
- Services: Varies by type
- Product: Processor
- Quantity: 2
- Unit Price: $500,000
- Subtotal: $1,000,000
- IVA (19%): $190,000
- Total: $1,190,000
Tax-Exempt Items
Some products may be exempt:- Educational books and materials
- Certain medical devices
- Agricultural products
- Items with special IVA rates (5% or 0%)
Configure product-specific IVA rates in the product catalog. Default is 19% for all items.
Credit Notes
For returns and adjustments:When to Issue Credit Notes
- Customer returns products
- Pricing error in original invoice
- Product defects or damages
- Order cancellation after invoicing
Credit Note Process
- Identify original invoice that needs correction
- Create credit note referencing original CUFE
- Specify reason for credit
- Generate through provider API
- Transmit to DIAN for approval
- Deliver to customer via email
Credit Note Requirements
Credit Note Requirements
Must Include:
- Reference to original invoice number
- Original invoice CUFE
- Reason for credit
- Items being credited
- Credit amount
- New CUFE for credit note
- Must be issued within legal timeframe
- Cannot exceed original invoice amount
- Requires proper justification
- Affects both parties’ tax obligations
Invoice Storage and Retrieval
Storage System
Invoices are stored in multiple locations: Local Server:- Directory:
uploads/facturas/ - Filename:
factura_[order_id]_[timestamp].pdf - Database reference in
pedidostable
- Available on Alegra/Siigo dashboard
- Can be re-downloaded if local copy lost
- Includes full invoice history
- All invoices registered with DIAN
- Searchable by CUFE
- Permanent legal record
Retention Period
Colombian law requires businesses to retain electronic invoices for 5 years. Ensure regular backups of invoice files.
Administration Interface
Viewing Invoices
Administrators can: View All Invoices:- Navigate to Admin → Facturas
- See list of all generated invoices
- Filter by date, customer, status
- Download individual or batch PDFs
- Order information
- Customer data
- Invoice status (sent, viewed, paid)
- CUFE and DIAN approval status
- Generation timestamp
Troubleshooting Failed Invoices
If invoice generation fails:- Check error log for API response
- Verify credentials in configuration
- Validate order data completeness
- Retry generation after fixing issues
- Contact provider support if needed
Common Invoice Generation Errors
Common Invoice Generation Errors
Invalid Customer Data:
- Missing email address
- Invalid ID format
- Incomplete billing address Solution: Update customer information and retry
- Expired API token
- Incorrect credentials
- Account suspended Solution: Verify credentials in config file
- Invalid NIT format
- Duplicate invoice number
- Tax calculation error Solution: Check DIAN error details and correct
- Service temporarily down
- Rate limit exceeded
- Network connectivity issue Solution: Wait and retry, or contact provider
Configuration
Setup Checklist
1. Choose Provider
Select Alegra or Siigo based on your needs
2. Get Credentials
Sign up with provider and obtain API credentials
3. Configure System
Update config/factura_config.php with credentials
4. Test Integration
Use simulation mode to test before going live
Configuration File
Editconfig/factura_config.php:
Best Practices
Monitor Daily
Check that all paid orders have invoices generated
Backup Regularly
Back up invoice PDFs and database records
Test Changes
Use simulation mode when testing new features
Keep Updated
Stay current with DIAN regulation changes
Compliance Recommendations
- Generate invoices within 24 hours of payment
- Verify CUFE codes periodically
- Maintain complete audit trail
- Issue credit notes promptly for returns
- Keep provider credentials secure
- Monitor DIAN compliance status
Customer Experience
From the customer’s perspective:- Place order and complete payment
- Receive confirmation email immediately
- Invoice attached to email automatically
- Can download from order history page
- Verify authenticity using CUFE on DIAN website
Customers appreciate receiving invoices automatically. It builds trust and provides necessary documentation for personal or business records.
Legal Considerations
DIAN Compliance
- All invoices must be transmitted to DIAN
- Electronic invoices have same legal validity as paper
- Must use authorized provider (Alegra, Siigo, etc.)
- Cannot use custom or home-built invoicing for DIAN
- Penalties for non-compliance can be severe
Resolution Number
Your business must have:- DIAN authorization to issue electronic invoices
- Assigned resolution number
- Valid numbering range
- Authorized provider relationship
Support Resources
- DIAN Website: https://www.dian.gov.co
- Alegra Support: https://ayuda.alegra.com
- Siigo Support: https://ayuda.siigo.com
- CompuTécnicos Docs: See accounting features documentation