Covers the main Accounting API surface used in production integrations.
accounting.contacts.read/accounting.contacts: contacts and contact groupsaccounting.settings.read/accounting.settings: accounts, items, tax rates, tracking categories, branding themes, organisations, usersaccounting.transactions.read/accounting.transactions: invoices, payments, credit notes, bank transactions, manual journals, purchase orders, quotes, receipts, repeating invoices
$contacts = $xero->accounting()
->contacts()
->where('Name.Contains(:name)', name: 'Acme')
->orderBy('Name')
->page(1)
->get();use Sujip\Xero\Accounting\Contact\Contact;
$contact = $xero->accounting()
->contacts()
->create()
->using(
(new Contact())
->setName('Acme Pty Ltd')
->setEmailAddress('accounts@acme.test')
)
->save();use Sujip\Xero\Accounting\Contact\Contact;
$updated = $xero->accounting()
->contacts()
->update('contact-id')
->using(
(new Contact())
->setContactID('contact-id')
->setName('Acme Holdings Pty Ltd')
)
->save();$contact = $xero->accounting()
->contacts()
->create()
->using(
(new \Sujip\Xero\Accounting\Contact\Contact())
->setName('Acme Pty Ltd')
->addPhone(
(new \Sujip\Xero\Accounting\Contact\Phone())
->setPhoneType('DEFAULT')
->setPhoneNumber('5551234')
)
->addAddress(
(new \Sujip\Xero\Accounting\Contact\Address())
->setAddressType('STREET')
->setAddressLine1('100 George Street')
->setCity('Sydney')
)
)
->save();use Sujip\Xero\Accounting\Invoice\Invoice;
use Sujip\Xero\Accounting\Contact\Contact;
use Sujip\Xero\Accounting\Invoice\LineItem;
$invoice = $xero->accounting()
->invoices()
->create()
->using(
(new Invoice())
->setType('ACCREC')
->setStatus('DRAFT')
->setContact(
(new Contact())
->setContactID('contact-id')
)
->setReference('PO-1001')
->addLineItem(
(new LineItem())
->setDescription('Consulting')
->setQuantity(2)
->setUnitAmount(150)
)
)
->save();use Sujip\Xero\Accounting\Invoice\Invoice;
$updated = $xero->accounting()
->invoices()
->update('invoice-id')
->using(
(new Invoice())
->setInvoiceID('invoice-id')
->setReference('PO-1002')
)
->save();$pdf = $xero->accounting()
->invoices()
->pdf('invoice-id');$attachment = $xero->accounting()
->invoices()
->attachments('invoice-id')
->upload('invoice.pdf', $pdfBinary)
->mimeType('application/pdf')
->includeOnline()
->save();$binary = $xero->accounting()
->invoices()
->attachments('invoice-id')
->download('invoice.pdf', 'application/pdf');$history = $xero->accounting()
->invoices()
->history('invoice-id')
->record('Invoice synced from back office');$settings = $xero->accounting()
->invoiceReminders()
->settings();
$enabled = $settings->getEnabled();
$days = $settings->getDays();use Sujip\Xero\Accounting\Account\Account;
use Sujip\Xero\Accounting\Payment\Payment;
$payment = $xero->accounting()
->payments()
->create()
->using(
(new Payment())
->setInvoiceID('invoice-id')
->setAccount(
(new Account())
->setAccountID('account-id')
)
->setDate('2026-03-25')
->setAmount(150)
->setReference('PAY-1001')
)
->save();use Sujip\Xero\Accounting\Payment\Payment;
$updated = $xero->accounting()
->payments()
->update('payment-id')
->using(
(new Payment())
->setPaymentID('payment-id')
->setReference('PAY-1002')
)
->save();$history = $xero->accounting()
->payments()
->history('payment-id')
->record('Payment reconciled');$attachment = $xero->accounting()
->receipts()
->attachments('receipt-id')
->upload('receipt.jpg', $binaryImage)
->mimeType('image/jpeg')
->save();$binary = $xero->accounting()
->receipts()
->attachments('receipt-id')
->download('receipt.jpg', 'image/jpeg');$receipt = $xero->accounting()
->receipts()
->find('receipt-id');
$contactId = $receipt?->getContact()?->getContactID();$accounts = $xero->accounting()
->accounts()
->where('Status == :status', status: 'ACTIVE')
->orderBy('Code')
->get();$account = $xero->accounting()
->accounts()
->create()
->using(
(new \Sujip\Xero\Accounting\Account\Account())
->setCode('200')
->setName('Sales')
->setType('REVENUE')
->setDescription('Primary sales account')
)
->save();$updated = $xero->accounting()
->accounts()
->update('account-id')
->using(
(new \Sujip\Xero\Accounting\Account\Account())
->setAccountID('account-id')
->setName('Primary Sales')
)
->save();$items = $xero->accounting()
->items()
->where('Code == :code', code: 'ABC123')
->unitDp(4)
->get();$item = $xero->accounting()
->items()
->create()
->using(
(new \Sujip\Xero\Accounting\Item\Item())
->setCode('ABC123')
->setName('Widget')
->setDescription('Standard widget')
)
->save();$history = $xero->accounting()
->items()
->history('item-id')
->record('Item updated from ERP');$taxRates = $xero->accounting()
->taxRates()
->where('Status == :status', status: 'ACTIVE')
->orderBy('Name')
->get();$taxRate = $xero->accounting()
->taxRates()
->create()
->using(
(new \Sujip\Xero\Accounting\TaxRate\TaxRate())
->setTaxType('OUTPUT')
->setName('GST')
->addTaxComponent(
(new \Sujip\Xero\Accounting\TaxRate\Component())
->setName('GST')
->setRate(15)
)
)
->save();$categories = $xero->accounting()
->trackingCategories()
->includeArchived()
->get();$category = $xero->accounting()
->trackingCategories()
->create()
->using(
(new \Sujip\Xero\Accounting\TrackingCategory\TrackingCategory())
->setName('Region')
->addOption(
(new \Sujip\Xero\Accounting\TrackingCategory\Option())
->setName('APAC')
)
)
->save();$category = $xero->accounting()
->trackingCategories()
->create()
->name('Region')
->save();$currencies = $xero->accounting()
->currencies()
->get();$currency = $xero->accounting()
->currencies()
->create()
->using(
(new \Sujip\Xero\Accounting\Currency\Currency())
->setCode('EUR')
->setDescription('Euro')
)
->save();$themes = $xero->accounting()
->brandingThemes()
->get();$organisation = $xero->accounting()
->organisations()
->current();$groups = $xero->accounting()
->contactGroups()
->where('Status == :status', status: 'ACTIVE')
->get();$group = $xero->accounting()
->contactGroups()
->create()
->name('Strategic Partners')
->save()
->attachContacts('contact-id');$users = $xero->accounting()
->users()
->where('IsSubscriber == :sub', sub: true)
->orderBy('LastName')
->get();This endpoint is deprecated by Xero. Use the Payroll API for employee management.
$employees = $xero->accounting()
->employees()
->where('Status == :status', status: 'ACTIVE')
->orderBy('LastName')
->get();
$firstEmployee = $employees->first();
$employeeId = $firstEmployee?->getEmployeeID();
$firstName = $firstEmployee?->getFirstName();$employee = $xero->accounting()
->employees()
->create()
->firstName('Maria')
->lastName('Hill')
->email('maria@example.test')
->save();$creditNotes = $xero->accounting()
->creditNotes()
->where('Status == :status', status: 'AUTHORISED')
->get();$creditNote = $xero->accounting()
->creditNotes()
->create()
->using(
(new \Sujip\Xero\Accounting\CreditNote\CreditNote())
->setType('ACCRECCREDIT')
->setContact(
(new \Sujip\Xero\Accounting\Contact\Contact())
->setContactID('contact-id')
)
->setReference('CN-1001')
->addLineItem(
(new \Sujip\Xero\Accounting\Invoice\LineItem())
->setDescription('Adjustment')
->setQuantity(1)
->setUnitAmount(50)
)
)
->save();$attachments = $xero->accounting()
->creditNotes()
->attachments('credit-note-id')
->get();$binary = $xero->accounting()
->creditNotes()
->attachments('credit-note-id')
->downloadById('attachment-id', 'application/pdf');$history = $xero->accounting()
->creditNotes()
->history('credit-note-id')
->record('Credit note synced from ERP');$pdf = $xero->accounting()
->creditNotes()
->pdf('credit-note-id');$transactions = $xero->accounting()
->bankTransactions()
->where('Status == :status', status: 'AUTHORISED')
->get();$transaction = $xero->accounting()
->bankTransactions()
->create()
->using(
(new \Sujip\Xero\Accounting\BankTransaction\BankTransaction())
->setType('SPEND')
->setContact(
(new \Sujip\Xero\Accounting\Contact\Contact())
->setContactID('contact-id')
)
->setBankAccount(
(new \Sujip\Xero\Accounting\BankTransaction\BankAccount())
->setAccountID('account-id')
)
->setReference('BT-1001')
->addLineItem(
(new \Sujip\Xero\Accounting\Invoice\LineItem())
->setDescription('Office supplies')
->setQuantity(1)
->setUnitAmount(25)
)
)
->save();$bankTransfers = $xero->accounting()
->bankTransfers()
->where('Amount > :amount', amount: 100)
->get();$bankTransfer = $xero->accounting()
->bankTransfers()
->create()
->fromBankAccount('bank-account-a')
->toBankAccount('bank-account-b')
->amount(400)
->reference('Daily sweep')
->save();$links = $xero->accounting()
->linkedTransactions()
->sourceTransaction('source-id')
->status('ACTIVE')
->get();$link = $xero->accounting()
->linkedTransactions()
->create()
->sourceTransaction('source-id')
->targetTransaction('target-id')
->contact('contact-id')
->save();$overpayments = $xero->accounting()
->overpayments()
->where('Status == :status', status: 'AUTHORISED')
->get();$prepayments = $xero->accounting()
->prepayments()
->where('Status == :status', status: 'AUTHORISED')
->get();$batchPayments = $xero->accounting()
->batchPayments()
->where('Status == :status', status: 'AUTHORISED')
->get();$batchPayment = $xero->accounting()
->batchPayments()
->create()
->account('account-id')
->reference('BATCH-1001')
->payment('invoice-id', 75)
->save();$manualJournals = $xero->accounting()
->manualJournals()
->where('Status == :status', status: 'POSTED')
->get();$manualJournal = $xero->accounting()
->manualJournals()
->create()
->narration('Month end adjustments')
->line(100, '200', true)
->line(100, '300', false)
->save();$binary = $xero->accounting()
->manualJournals()
->attachments('manual-journal-id')
->download('journal.pdf', 'application/pdf');$purchaseOrders = $xero->accounting()
->purchaseOrders()
->where('Status == :status', status: 'AUTHORISED')
->get();$purchaseOrder = $xero->accounting()
->purchaseOrders()
->create()
->using(
(new \Sujip\Xero\Accounting\PurchaseOrder\PurchaseOrder())
->setContact(
(new \Sujip\Xero\Accounting\Contact\Contact())
->setContactID('contact-id')
)
->setReference('PO-REF')
->addLineItem(
(new \Sujip\Xero\Accounting\Invoice\LineItem())
->setDescription('Hardware')
->setQuantity(1)
->setUnitAmount(250)
)
)
->save();$attachment = $xero->accounting()
->purchaseOrders()
->attachments('purchase-order-id')
->upload('purchase-order.pdf', $pdfBinary)
->mimeType('application/pdf')
->includeOnline()
->save();$binary = $xero->accounting()
->purchaseOrders()
->attachments('purchase-order-id')
->downloadById('attachment-id', 'application/pdf');$quotes = $xero->accounting()
->quotes()
->where('Status == :status', status: 'DRAFT')
->get();$quote = $xero->accounting()
->quotes()
->create()
->using(
(new \Sujip\Xero\Accounting\Quote\Quote())
->setContact(
(new \Sujip\Xero\Accounting\Contact\Contact())
->setContactID('contact-id')
)
->setTitle('Website redesign')
->addLineItem(
(new \Sujip\Xero\Accounting\Invoice\LineItem())
->setDescription('Design sprint')
->setQuantity(1)
->setUnitAmount(1200)
)
)
->save();$pdf = $xero->accounting()
->quotes()
->pdf('quote-id');$receipts = $xero->accounting()
->receipts()
->where('Status == :status', status: 'DRAFT')
->unitDp(4)
->get();$repeatingInvoices = $xero->accounting()
->repeatingInvoices()
->where('Status == :status', status: 'DRAFT')
->get();$repeatingInvoice = $xero->accounting()
->repeatingInvoices()
->create()
->type('ACCREC')
->contact('contact-id')
->reference('RI-1001')
->lineItem('Monthly support', 1, 99)
->save();$services = $xero->accounting()
->paymentServices()
->get();
$firstService = $services->first();
$serviceName = $firstService?->getPaymentServiceName();
$payNowText = $firstService?->getPayNowText();$service = $xero->accounting()
->paymentServices()
->create()
->name('Stripe')
->url('https://example.test/pay')
->payNowText('Pay online')
->save();$claims = $xero->accounting()
->expenseClaims()
->where('Status == :status', status: 'SUBMITTED')
->get();
$firstClaim = $claims->first();
$claimId = $firstClaim?->getExpenseClaimID();
$status = $firstClaim?->getStatus();$claim = $xero->accounting()
->expenseClaims()
->create()
->employee('employee-id')
->receipt('receipt-id')
->status('DRAFT')
->save();$journals = $xero->accounting()
->journals()
->offset(1200)
->paymentsOnly()
->get();$journal = $xero->accounting()
->journals()
->number(1251);
$journalId = $journal?->getJournalID();
$journalNumber = $journal?->getJournalNumber();$reports = $xero->accounting()
->reports()
->list();
$firstReport = $reports->first();
$reportName = $firstReport?->getReportName();
$reportType = $firstReport?->getReportType();$profitAndLoss = $xero->accounting()
->reports()
->profitAndLoss([
'fromDate' => new DateTimeImmutable('2026-01-01'),
'toDate' => new DateTimeImmutable('2026-03-25'),
]);
$title = $profitAndLoss?->getReportTitle();