Credit notes, lifecycle actions & payments
Draft CreditNotes, authorise/void invoices, submit/authorise purchase orders, and record payments via x0 → Xero.
Scopes
| Scope | Use |
|---|---|
xero.creditnotes.write |
CreditNotes CRUD + OData |
xero.invoices.write |
Includes /authorise and /void on existing invoice routes |
xero.purchaseorders.write |
Includes /submit and /authorise on PO routes |
xero.payments.write |
PUT /v1/payments — record payment against invoice/bill |
Upstream OAuth: accounting.transactions (credit notes, invoice/PO status) and accounting.payments (payments).
CreditNotes (draft-first)
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/credit-notes/preflight |
{action, credit_note_id?, payload?} |
PUT |
/v1/credit-notes |
Create — Type (ACCRECCREDIT / ACCPAYCREDIT), Contact, LineItems; default DRAFT |
POST |
/v1/credit-notes/{id} |
Update draft fields |
DELETE |
/v1/credit-notes/{id} |
Delete drafts only |
OData: POST/PATCH/DELETE /odata/v1/CreditNotes — same as other write entities.
CreditNotes lifecycle
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/credit-notes/{id}/authorise |
Sets Status=AUTHORISED |
POST |
/v1/credit-notes/{id}/void |
Sets Status=VOIDED |
Purchase order bill
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/purchase-orders/{id}/bill |
Fetches PO, creates ACCPAY bill (draft by default), tries Status=BILLED on PO |
Optional body: Date, DueDate, Reference, InvoiceNumber, Status, LineAmountTypes, CurrencyCode, CurrencyRate.
Xero does not natively link bill ↔ PO in the API — x0 sets bill Reference to the PO number. PO should be AUTHORISED. Bill creation uses the same upstream path as /v1/invoices (xero.invoices.write on the API key is required in practice).
Payment delete / reversal
| Method | Path | Behaviour |
|---|---|---|
DELETE |
/v1/payments/{payment_id} |
Removes payment in Xero (?invoice_id= optional for cache dirty) |
Preflight action delete / reverse.
Invoice lifecycle
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/invoices/{id}/authorise |
Sets Status=AUTHORISED (DRAFT/SUBMITTED → approved) |
POST |
/v1/invoices/{id}/void |
Sets Status=VOIDED (AUTHORISED only; no payments/credits applied) |
Draft field updates remain on POST /v1/invoices/{id} without status changes.
Purchase order lifecycle
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/purchase-orders/{id}/submit |
Sets Status=SUBMITTED |
POST |
/v1/purchase-orders/{id}/authorise |
Sets Status=AUTHORISED |
Bill-from-PO and payment delete — see sections below.
Payments
| Method | Path | Behaviour |
|---|---|---|
POST |
/v1/payments/preflight |
Validate {Invoice, Account, Amount, Date?} |
PUT |
/v1/payments |
Create payment — invoice must be AUTHORISED |
DELETE |
/v1/payments/{payment_id} |
Delete / reverse payment |
Example body:
{
"Invoice": {"InvoiceID": "…"},
"Account": {"Code": "090"},
"Amount": 100.00,
"Date": "2026-08-25"
}
Marks payments and related invoices caches dirty on success.
Simulator
xerosim upserts CreditNotes and Payments (PUT/POST). Invoice/PO status changes use the same upsert path as field updates.