Skip to content
Fosnez edited this page Mar 27, 2019 · 5 revisions

Usage by example:

Finding Invoices that are "Authorized" for one client within a date range:

$invoices = $xero->load(Invoice::class)
    ->where('Status', Invoice::INVOICE_STATUS_AUTHORISED)
    ->where('Type', Invoice::INVOICE_TYPE_ACCREC)
    ->where('Date >= DateTime(2019, 01, 01) && Date <= DateTime(2019, 12, 31)')
    ->where('Contact.ContactID', $contactId)
    ->execute();

Gotchas:

  • When updating (Inventory) Items, error "Price List Item Code must be supplied" is thrown. "Code" was not part of the update request because it is not dirty. Must manually $item->setDirty('Code'); to fulfill the requirement.
  • The OAuth client used by \XeroPHP\Application\PrivateApplication requires all 4 keys of callback, consumer_key, consumer_secret and rsa_private_key to be present, but their value can be an empty string.
Clone this wiki locally