This example demonstrates the simplest possible invoice you can create with the UBL Builder library. It includes only the essential fields required for a valid UBL 2.1 invoice.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pipesanta/ubl-builder/llms.txt
Use this file to discover all available pages before exploring further.
Installation
First, install the library:Basic Invoice Code
Generated XML Output
The code above generates the following UBL 2.1 XML:Adding Basic Fields
Let’s enhance the invoice with additional required fields:Key Fields Explained
| Field | Description |
|---|---|
ID | Unique invoice number |
UBLVersionID | UBL standard version (typically “UBL 2.1”) |
IssueDate | Date the invoice was issued (YYYY-MM-DD format) |
IssueTime | Time the invoice was issued (HH:MM:SS±HH:MM format) |
InvoiceTypeCode | Type of invoice (01 = standard, 02 = credit note, etc.) |
DocumentCurrencyCode | Currency code (USD, EUR, COP, etc.) |
Note | Additional notes or payment terms |
The invoice constructor requires two parameters:
- Invoice ID (string): The unique invoice identifier
- Options (object): Configuration object with issuer, software, and environment details
Next Steps
- Learn how to add tax calculations in Invoice with Tax
- See a full-featured invoice in Complete Invoice
- Explore the API Reference for all available methods