Generic XML Invoice
A vendor-neutral XML invoice shape covering the fields most senders carry: header, party blocks, addresses, payment terms, line items, tax detail, invoice-level charges, and cash discounts. Use this seed as a starting point for any custom XML dialect whose structure roughly matches the shape below — clone it, adjust element names / XPaths, and go.
Config item ID
generic-xml-invoice
Pick this in the admin portal when creating a customer file format from a global template, or select the same config item ID via the API.
Notable conventions
- Split dates. Dates are split into
YEAR,MONTH, andDAYsub-elements. The seed's date locators assemble the canonicalYYYY-MM-DDstring inline with XPath'sconcat()function. - Amounts. Amount elements carry their sign as part of the value:
positive amounts are just the number (
100.00), negative amounts have a leading minus (-25.00). NoSIGNattribute; the locator is a plainnumber(./NET_AMOUNT). - Flat references.
ORDER_REFERENCEandCONTRACT_REFERENCEare flat text elements on the header — no nestedREFERENCE_NUMBERchild. - Ship-to and bill-to. Both party blocks nest their own
NAMEandPOSTAL_ADDRESS. Bill-to lives underBUYER_PARTY; ship-to lives underDELIVERY_PARTY. The buyer party's ownNAMEbecomes the canonical customer name; the address'sNAMEbecomes the bill-to (or ship-to) party name. - Taxes, charges, and discounts are separate top-level containers.
Each has its own element (
TAXES/TAX,CHARGES/CHARGE,DISCOUNTS/DISCOUNT) and its own loop.
Loops
invoice loop ← recordType: header, xpath: /INVOICE
seller loop ← recordType: none, scope: sender xpath: ./PARTIES/SELLER_PARTY
buyer loop ← recordType: none, scope: receiver xpath: ./PARTIES/BUYER_PARTY
billto loop ← recordType: none, scope: bill_to xpath: ./PARTIES/BUYER_PARTY/POSTAL_ADDRESS
shipto loop ← recordType: none, scope: ship_to xpath: ./PARTIES/DELIVERY_PARTY/POSTAL_ADDRESS
payment loop ← recordType: none, scope: payment xpath: ./PAYMENT_TERMS
line loop ← recordType: line xpath: ./DETAILS/ROW
taxes loop ← recordType: taxes xpath: ./TAXES/TAX
charges loop ← recordType: charges xpath: ./CHARGES/CHARGE
discounts loop ← recordType: discounts, xpath: ./DISCOUNTS/DISCOUNT
Fields
Fields are grouped by loop. XPaths are relative to the loop's context node,
so ./STREET on a field under the billto loop resolves to
BUYER_PARTY/POSTAL_ADDRESS/STREET. Date locators are summarized here —
see the seed itself for the exact XPath expression.
Header (loop invoice)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./HEADER/INVOICE_NUMBER | header.invoice_number | text | Sender-issued invoice number. |
concat(./HEADER/INVOICE_DATE/DATE/YEAR, "-", MONTH, "-", DAY) | header.invoice_date | date | Date the invoice was issued. |
concat(./HEADER/DUE_DATE/DATE/YEAR, "-", MONTH, "-", DAY) | header.due_date | date | Date the full amount is due. |
concat(./HEADER/DELIVERY_DATE/DATE/YEAR, "-", MONTH, "-", DAY) | header.delivery_date | date | Date the goods or services were delivered. |
./HEADER/CURRENCY_CODE | header.currency_code | text | ISO 4217 currency code. |
./HEADER/ORDER_REFERENCE | header.order_number_1 | text | Buyer purchase order number. |
./HEADER/CONTRACT_REFERENCE | header.contract_number | text | Master or framework contract reference. |
./PARTIES/BUYER_PARTY/TAX_ID | header.customer_tax_id | text | Buyer VAT / tax registration number. |
number(./HEADER/NET_AMOUNT) | header.net_amount | number | Invoice-level net (pre-tax) total. |
number(./HEADER/VAT_TOTAL) | header.tax_amount | number | Invoice-level total tax. |
number(./HEADER/GROSS_AMOUNT) | header.gross_amount | number | Invoice-level total gross (net + tax). |
Supplier (loop seller → sender scope)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./NAME | sender.supplier_name | text | Supplier / vendor legal name. |
./TAX_ID | sender.supplier_tax_id | text | Supplier VAT / tax registration number. |
Customer (loop buyer → receiver scope)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./NAME | receiver.customer_name | text | Buyer / customer legal name. |
Bill-to address (loop billto → bill_to scope)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./NAME | bill_to.address_name | text | Bill-to party name or department. |
./STREET | bill_to.street | text | Bill-to street address. |
./CITY | bill_to.city | text | Bill-to city. |
./POSTAL_CODE | bill_to.postal_code | text | Bill-to postal / ZIP code. |
./STATE | bill_to.state | text | Bill-to state or region. |
./COUNTRY | bill_to.country | text | Bill-to country (ISO 3166-1 alpha-2). |
Ship-to address (loop shipto → ship_to scope)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./NAME | ship_to.address_name | text | Ship-to party name or department. |
./STREET | ship_to.street | text | Ship-to street address. |
./CITY | ship_to.city | text | Ship-to city. |
./POSTAL_CODE | ship_to.postal_code | text | Ship-to postal / ZIP code. |
./STATE | ship_to.state | text | Ship-to state or region. |
./COUNTRY | ship_to.country | text | Ship-to country (ISO 3166-1 alpha-2). |
Payment (loop payment → payment scope)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./PAYMENT_REFERENCE | payment.reference_number | text | Payment reference the buyer should quote when remitting. |
./PAYMENT_METHOD | payment.payment_method | text | Preferred payment method (ACH, wire, cheque, …). |
./BANK/ACCOUNT_NUMBER | payment.bank_account | text | Supplier bank account (IBAN or local format). |
./BANK/BANK_NAME | payment.bank_name | text | Supplier bank name. |
Line items (loop line → line records)
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./PRODUCT_CODE | line.product_code_1 | text | Supplier product / SKU code. |
./DESCRIPTION | line.product_name | text | Product or service description. |
./QUANTITY | line.quantity | number | Line quantity. |
./QUANTITY/@UNIT | line.unit_of_measure | text | Unit of measure (EA, BX, KG, …). |
./UNIT_PRICE | line.unit_price | number | Price per unit. |
number(./NET_AMOUNT) | line.net_amount | number | Line net (pre-tax) amount. |
./VAT_RATE | line.tax_rate | number | Line tax rate as a percentage. |
number(./VAT_AMOUNT) | line.tax_amount | number | Line tax amount. |
number(./GROSS_AMOUNT) | line.gross_amount | number | Line gross amount (net + tax). |
Taxes (loop taxes → taxes records)
One record per TAXES/TAX element.
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./TAX_NAME | taxes.tax_name | text | Tax category or jurisdiction name. |
./TAX_RATE | taxes.tax_rate | number | Tax rate as a percentage. |
number(./BASE_AMOUNT) | taxes.tax_base_amount | number | Amount the tax rate is applied to. |
number(./TAX_AMOUNT) | taxes.tax_amount | number | Tax amount for this category. |
Charges (loop charges → charges records)
Invoice-level charges (freight, handling, insurance, …). One record per
CHARGES/CHARGE element.
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./DESCRIPTION | charges.charge_name | text | Charge description (freight, handling, insurance, …). |
number(./AMOUNT) | charges.charge_amount | number | Charge amount. |
Discounts (loop discounts → discounts records)
Cash discounts (early-payment, promotional, …). One record per
DISCOUNTS/DISCOUNT element. Discount amounts are stored as the value
they carry — negative amounts appear as -25.00.
The deadline for taking the discount can be expressed two ways: as an
absolute date (DISCOUNT_DUE_DATE) or as a term relative to a basis
date (DUE_DATE_BASIS + DUE_DATE_PERIOD_VALUE + DUE_DATE_PERIOD_MEASURE,
e.g. "10 DAY from invoice date"). Senders that emit both should populate
both; downstream processing prefers the absolute date when present.
| XPath (relative to loop) | Field | Type | Description |
|---|---|---|---|
./DESCRIPTION | discounts.discount_description | text | Human-readable description of the discount. |
./PERCENTAGE | discounts.discount_rate | number | Discount rate as a percentage. |
number(./AMOUNT) | discounts.discount_amount | number | Discount amount. |
./DISCOUNT_DUE_DATE | discounts.discount_due_date | date | Absolute date on which the discount expires. Canonical YYYY-MM-DD. |
./DUE_DATE_BASIS | discounts.due_date_basis | date | Date the discount period is counted from (typically the invoice or delivery date). Canonical YYYY-MM-DD. |
number(./DUE_DATE_PERIOD_VALUE) | discounts.due_date_period_value | number | Number of periods from due_date_basis until the discount expires (integer). |
./DUE_DATE_PERIOD_MEASURE | discounts.due_date_period_measure | text | Unit for the period value. One of DAY, WEEK, MONTH, YEAR. Map sender-side values (e.g. CII WEE/ANN, EDIFACT D/W) to this set. |
Sample file
Download generic-xml-invoice.xml
<?xml version="1.0" encoding="UTF-8"?>
<INVOICE TYPE="Invoice" LANGUAGE_CODE="en">
<HEADER>
<INVOICE_NUMBER>INV-2025-0042</INVOICE_NUMBER>
<INVOICE_TYPE_CODE>380</INVOICE_TYPE_CODE>
<INVOICE_DATE>
<DATE>
<YEAR>2026</YEAR>
<MONTH>07</MONTH>
<DAY>15</DAY>
</DATE>
</INVOICE_DATE>
<DUE_DATE>
<DATE>
<YEAR>2026</YEAR>
<MONTH>08</MONTH>
<DAY>14</DAY>
</DATE>
</DUE_DATE>
<DELIVERY_DATE>
<DATE>
<YEAR>2026</YEAR>
<MONTH>07</MONTH>
<DAY>12</DAY>
</DATE>
</DELIVERY_DATE>
<CURRENCY_CODE>USD</CURRENCY_CODE>
<ORDER_REFERENCE>PO-88190</ORDER_REFERENCE>
<CONTRACT_REFERENCE>MSA-2024-11</CONTRACT_REFERENCE>
<NET_AMOUNT>1250.00</NET_AMOUNT>
<VAT_TOTAL>112.50</VAT_TOTAL>
<GROSS_AMOUNT>1362.50</GROSS_AMOUNT>
</HEADER>
<PARTIES>
<SELLER_PARTY>
<NAME>Northwind Manufacturing LLC</NAME>
<TAX_ID>US-441290</TAX_ID>
<POSTAL_ADDRESS>
<STREET>1500 Foundry Road</STREET>
<CITY>Reno</CITY>
<POSTAL_CODE>89501</POSTAL_CODE>
<STATE>NV</STATE>
<COUNTRY>US</COUNTRY>
</POSTAL_ADDRESS>
</SELLER_PARTY>
<BUYER_PARTY>
<NAME>Contoso Retail Group</NAME>
<TAX_ID>US-849201</TAX_ID>
<POSTAL_ADDRESS>
<NAME>Contoso Accounts Payable</NAME>
<STREET>450 Market Street, Suite 200</STREET>
<CITY>San Francisco</CITY>
<POSTAL_CODE>94105</POSTAL_CODE>
<STATE>CA</STATE>
<COUNTRY>US</COUNTRY>
</POSTAL_ADDRESS>
</BUYER_PARTY>
<DELIVERY_PARTY>
<NAME>Contoso Retail Group</NAME>
<POSTAL_ADDRESS>
<NAME>Contoso Distribution Center</NAME>
<STREET>901 Airport Way</STREET>
<CITY>Reno</CITY>
<POSTAL_CODE>89502</POSTAL_CODE>
<STATE>NV</STATE>
<COUNTRY>US</COUNTRY>
</POSTAL_ADDRESS>
</DELIVERY_PARTY>
</PARTIES>
<PAYMENT_TERMS>
<PAYMENT_REFERENCE>INV-2025-0042</PAYMENT_REFERENCE>
<PAYMENT_METHOD>ACH</PAYMENT_METHOD>
<BANK>
<ACCOUNT_NUMBER>US1234567890</ACCOUNT_NUMBER>
<BANK_NAME>First National Bank</BANK_NAME>
</BANK>
</PAYMENT_TERMS>
<TAXES>
<TAX>
<TAX_NAME>CA State</TAX_NAME>
<TAX_RATE>6.00</TAX_RATE>
<BASE_AMOUNT>1250.00</BASE_AMOUNT>
<TAX_AMOUNT>75.00</TAX_AMOUNT>
</TAX>
<TAX>
<TAX_NAME>County Levy</TAX_NAME>
<TAX_RATE>3.00</TAX_RATE>
<BASE_AMOUNT>1250.00</BASE_AMOUNT>
<TAX_AMOUNT>37.50</TAX_AMOUNT>
</TAX>
</TAXES>
<CHARGES>
<CHARGE>
<DESCRIPTION>Freight</DESCRIPTION>
<AMOUNT>45.00</AMOUNT>
</CHARGE>
<CHARGE>
<DESCRIPTION>Handling & pallet</DESCRIPTION>
<AMOUNT>15.00</AMOUNT>
</CHARGE>
</CHARGES>
<DISCOUNTS>
<DISCOUNT>
<DESCRIPTION>2/10 Net 30 early payment</DESCRIPTION>
<PERCENTAGE>2.00</PERCENTAGE>
<AMOUNT>-25.00</AMOUNT>
<DISCOUNT_DUE_DATE>2026-07-25</DISCOUNT_DUE_DATE>
<DUE_DATE_BASIS>2026-07-15</DUE_DATE_BASIS>
<DUE_DATE_PERIOD_VALUE>10</DUE_DATE_PERIOD_VALUE>
<DUE_DATE_PERIOD_MEASURE>DAY</DUE_DATE_PERIOD_MEASURE>
</DISCOUNT>
</DISCOUNTS>
<DETAILS>
<ROW>
<LINE_ID>1</LINE_ID>
<PRODUCT_CODE>SKU-4471</PRODUCT_CODE>
<DESCRIPTION>Stainless Bolt M6 x 20 (box of 100)</DESCRIPTION>
<QUANTITY UNIT="BX">5</QUANTITY>
<UNIT_PRICE>85.00</UNIT_PRICE>
<NET_AMOUNT>425.00</NET_AMOUNT>
<VAT_RATE>9.00</VAT_RATE>
<VAT_AMOUNT>38.25</VAT_AMOUNT>
<GROSS_AMOUNT>463.25</GROSS_AMOUNT>
</ROW>
<ROW>
<LINE_ID>2</LINE_ID>
<PRODUCT_CODE>SKU-4472</PRODUCT_CODE>
<DESCRIPTION>Stainless Nut M6 (box of 200)</DESCRIPTION>
<QUANTITY UNIT="BX">3</QUANTITY>
<UNIT_PRICE>55.00</UNIT_PRICE>
<NET_AMOUNT>165.00</NET_AMOUNT>
<VAT_RATE>9.00</VAT_RATE>
<VAT_AMOUNT>14.85</VAT_AMOUNT>
<GROSS_AMOUNT>179.85</GROSS_AMOUNT>
</ROW>
<ROW>
<LINE_ID>3</LINE_ID>
<PRODUCT_CODE>SKU-9013</PRODUCT_CODE>
<DESCRIPTION>Vibration Damper Kit</DESCRIPTION>
<QUANTITY UNIT="EA">2</QUANTITY>
<UNIT_PRICE>330.00</UNIT_PRICE>
<NET_AMOUNT>660.00</NET_AMOUNT>
<VAT_RATE>9.00</VAT_RATE>
<VAT_AMOUNT>59.40</VAT_AMOUNT>
<GROSS_AMOUNT>719.40</GROSS_AMOUNT>
</ROW>
</DETAILS>
</INVOICE>
Expected extraction
Running the sample through this seed extracts 1 invoice with fully
populated header, sender, receiver, bill-to, ship-to, and payment records,
plus 3 line items, 2 tax detail rows, 2 invoice-level charges,
and 1 cash discount. Split dates round-trip as YYYY-MM-DD; amounts
extract exactly as they appear in the source (negative amounts keep their
leading minus sign).