Java · Track 4 · Tutorial 1 of 4
Send your invoices
Send the month's sales invoices - who they were to, what for, and what's still owed - so every sales figure can be explained.
1What invoices add
The trial balance says September's sales were 30,000. Invoices say who they were to, what for, and what's still owed. They never change a figure: they explain the figures the trial balance already carries.
2Write the invoices
Create Invoices.java. Each invoice has an identity of its own - external_id, the one your system uses - a customer, a date, its total, and at least one line naming an account from the chart:
Invoices.java
// Invoices.java - sends September's sales invoices.
import java.util.List;
import java.util.Map;
public class Invoices {
public static void main(String[] args) throws Exception {
List<Map<String, Object>> invoices = List.of(
Map.of(
"external_id", "INV-1001",
"number", "INV-1001",
"party_name", "Harbour Trading Pte Ltd",
"party_country", "Singapore",
"date", "2026-09-08",
"due_date", "2026-10-08",
"total", 10000.00,
"amount_paid", 5000.00,
"amount_due", 5000.00,
"lines", List.of(
Map.of("line_item_id", "INV-1001-1", "account_code", "4000", "description", "Office chairs",
"quantity", 40, "unit_price", 250.00, "amount", 10000.00))));
var request = Brizo.written(Brizo.call("POST", "/organisations/" + Brizo.COMPANY_ID + "/invoices", Map.of(
"declarations", Map.of(
"source_reference", "my-ledger",
"period", "2026-09",
"value_basis", "company_base",
"rate_direction", "document_to_base",
"base_currency", "SGD"),
"records", invoices)));
Brizo.show("Invoices", request);
}
}The declarations are the month's: the month the invoices belong to, and the company's currency.
3Send them
gradle -q run -Pmain=InvoicesCheck
Invoices: request 96 - 1 created, 0 updated, 0 unchanged, 0 refused4Status works itself out
You don't have to send a status. BrizoConsol works it out from the amounts and the due date: nothing owed is PAID; money owed past the due date is OVERDUE; part paid is PARTIAL; the rest is OPEN. If your system marks a document as voided, send that as its status and it reads VOIDED.
5Send the whole month each time
Like the trial balance, invoices are sent month by month. Each send replaces the invoices this source holds for the month, so an invoice you leave out is removed. Send "mode": "merge" instead to add and update without removing anything.
6If an invoice is refused
| amount_disagrees_with_total | The lines, plus tax and less discount, don't come to the total. |
|---|---|
| account_not_found | A line names an account the chart doesn't hold. |
| lines_are_required | The invoice has no lines. |
| document_identity_belongs_to_another_source | Another source - a connected accounting system, for example - already holds an invoice with that identity. |
Each of these refuses one invoice; the others are still stored. A company holds up to 1,000 invoices a month, and an invoice up to 100 lines.
Want more detail? See the documentation