Skip to content

Xero Trigger

Overview

The Xero Trigger starts a workflow each time a payment is recorded in your Xero organisation, whether someone enters it by hand, reconciles it from the bank feed, or a customer pays online. Each payment starts the workflow once, with the amount, the invoice it pays and the customer available to the steps that follow.

It can also wait for the invoice instead of the payment: An invoice is paid in full starts the workflow once per invoice, when the last of it is paid.

When to use this trigger:

  • Mark the matching invoice as paid in BaseCloud when it is paid in Xero.
  • Tell the account manager the moment a customer pays.
  • Thank the customer, or start their onboarding, once their first invoice is paid in full.
  • Keep an eye on large payments to suppliers.
flowchart TD
    A[Payment recorded in Xero] --> B[Trigger starts the workflow]
    B --> C[Find the BaseCloud invoice it pays]
    C --> D{Invoice found?}
    D -->|Yes| E[Mark it as paid]
    D -->|No| F[Workflow note for a person to check]

Connecting Xero

The trigger uses the same Xero connection as the Xero task. Pick it under Xero Account, or choose + New Connection to connect Xero, then pick the Organisation to watch. See App connections.

If Xero asks you to sign in again, use Reconnect

Xero ends a connection that has not been used for 60 days, or when access is withdrawn in Xero. The connection then shows as Not Authorised under Settings → App Connections. Click Reconnect on that same connection. Reconnecting keeps the workflow's place, so every payment recorded while it was waiting still starts the workflow.

Configuration

Builder fields

The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.

Field Key Type Default Notes
Start this workflow when trigger_event select payment_received Options: A payment is recorded · An invoice is paid in full
Xero Account app_connection_id app-connection –
Organisation tenant_id select –
Which payments direction select in Options: Payments from customers (sales invoices) · Payments to suppliers (bills) · Both
Which bank accounts bank_account_ids select –
Only payments of at least (optional) min_amount number –
Only when the reference contains (optional) reference_contains text –

Which bank accounts is optional: leave it empty to watch payments into every bank account in Xero, or pick the ones your customers pay into. Only when the reference contains checks the payment's reference and the invoice's number and reference; capital letters do not matter.

How it behaves

  • It checks Xero about every 10 minutes, and within a few minutes when Xero lets BaseCloud know an invoice changed.
  • Each payment starts the workflow once. Reconciling or editing a payment in Xero later does not start it again. With An invoice is paid in full, each invoice starts it once.
  • Only payments on invoices and bills. Refunds and payments on credit notes, prepayments and overpayments are left out, as are deleted payments.
  • Nothing dated before the day you first switch it on is picked up. A payment entered today but dated earlier than that day is left out too.
  • It catches up on what it missed. If the workflow is switched off for a while, or the Xero connection needs reconnecting, the workflow runs for every payment recorded in the meantime as soon as it can read Xero again — about 100 payments every few minutes, so a long gap on a busy organisation takes a little while to work through.
  • An invoice settled without a payment is not picked up. An invoice paid off with a credit note, an overpayment or a prepayment has no payment of its own, so An invoice is paid in full does not start for it.
  • Changing the organisation or what starts the workflow starts it afresh from now. Picking another Xero connection to the same organisation does not.

Output Fields

Field Description
amount The payment's amount, for example 1250.5.
currency The invoice's currency code, for example USD.
payment_date The date of the payment in Xero, as YYYY-MM-DD.
reference The payment's reference.
direction in for a customer's payment, out for a payment to a supplier.
direction_label Money in or Money out.
is_reconciled Whether the payment was reconciled with the bank statement when it was picked up.
bank_account_name The bank account in Xero, for example Business Checking.
bank_account_code The bank account's code in Xero.
invoice_number The invoice's number, for example INV-0042. Use this to find the invoice in BaseCloud.
invoice_reference The invoice's reference.
invoice_status The invoice's status in Xero after the payment, for example PAID or AUTHORISED.
invoice_total The invoice's total.
invoice_amount_paid How much of the invoice has been paid, this payment included.
invoice_amount_due How much is still owed on the invoice. 0 once it is paid in full.
invoice_fully_paid true when the invoice is now paid in full.
invoice_date The invoice's date.
invoice_due_date The invoice's due date.
contact_name The customer or supplier on the invoice.
contact_account_number Their account number in Xero, when it has one.
contact_email Their email address in Xero, when Xero gives it.
payment_id The payment's identifier in Xero.
invoice_id The invoice's identifier in Xero.
contact_id The contact's identifier in Xero.
bank_account_id The bank account's identifier in Xero.
organisation_id The Xero organisation's identifier.
trigger_event payment_received or invoice_paid.
session_id The payment's identifier, as a stable key for each payment.
app_connection_id The Xero connection the payment came from.
{{task_ID_run_text}} Xero trigger executed successfully.

Testing

In the trigger's Input panel, select Load my payments to bring in the latest payments in the organisation that match the trigger's settings. Pick one and run the rest of the workflow on it.

Running later steps by hand does the real thing. If a step marks an invoice paid, test with an invoice you are happy to change.

Real-World Examples

Mark the BaseCloud invoice as paid when it is paid in Xero

Xero Trigger                       an invoice is paid in full
  └─ BaseCloud Accounting          Fetch Quote / Invoice with {{invoice_number}}
      └─ If Statement              invoice found
          ├─ true ─ BaseCloud Accounting   Mark Quote / Invoice Paid
          └─ false ─ Workflow Note         ask a person to check the payment

This works when your BaseCloud invoices are sent to Xero with the same invoice number, for example by a workflow that uses the Xero task to create the Xero invoice. See BaseCloud Accounting.

Tell the account manager a customer has paid

Xero Trigger                a payment is recorded, payments from customers
  └─ Workflow Note          tag the account manager with {{amount}} and {{invoice_number}}

Watch large payments to suppliers

Xero Trigger                a payment is recorded, payments to suppliers, at least 5000
  └─ Email                  send the amount, the supplier and the bill number to the owner

Best Practices

  • Keep invoice numbers the same in BaseCloud and Xero. It is the most reliable way to match a Xero payment to a BaseCloud invoice.
  • Use "An invoice is paid in full" to mark invoices paid. With A payment is recorded, a part-payment starts the workflow too; compare amount with invoice_total, or check invoice_fully_paid, before marking an invoice as paid.
  • Send what you cannot match to a person. An invoice marked paid by mistake is worse than one that waits for someone to look at it.

Troubleshooting

What you see What to do
The Xero connection shows Not Authorised Click Reconnect on that connection under Settings → App Connections. The workflow then catches up on what it missed.
A payment has not started the workflow yet Wait up to 10 minutes. Then check its date: payments dated before the day the trigger was switched on are not picked up.
Nothing starts the workflow Check Which payments, Which bank accounts and the two optional filters, and that the workflow is switched on. Refunds and credit-note payments never start it.
A part-payment did not start the workflow An invoice is paid in full waits for the last payment. Choose A payment is recorded to start it for every payment.
Load my payments finds nothing None of the latest payments in the organisation match the trigger's settings.
Organisation is empty Pick the Xero Account first. If it is still empty, reconnect the Xero connection and allow the organisation.
Which bank accounts says the list could not be loaded Your choices are still saved and still in use. Close the step and open it again.