Overview
TheInvoice class is the core component for creating UBL 2.1 compliant invoice documents. This guide covers the complete workflow from initialization to XML generation.
Basic Invoice Creation
Initialize the Invoice
Create a new invoice with an ID and configuration options:
The invoice ID should include the prefix (e.g., ‘SETP990000001’). The
enviroment field controls whether the invoice is for production (‘1’) or testing (‘2’).Add Parties
Add Tax Totals
Advanced Configuration
Payment Terms
Add payment terms to specify how and when payment should be made:Prepaid Payments
Record advance or prepaid amounts:Allowances and Charges
Add discounts or additional charges:Currency Exchange Rates
For multi-currency invoices:Colombian DIAN Extensions
For Colombian e-invoicing compliance, the library automatically handles DIAN extensions:Helper Methods
Finding Tax Totals
Retrieve tax amounts by scheme ID:Getting Invoice ID
Complete Example
Next Steps
Working with Parties
Learn how to add supplier, customer, and other party information
Tax Calculations
Master tax totals, subtotals, categories, and schemes
DIAN Extensions
Configure Colombian e-invoicing extensions
API Reference
Explore the complete API documentation