Skip to content
OpenNodeFlow.DocsOpen beta ↗
Agent guide ↗
Docs/Library asset reference

Xero Apply Invoice Payment

Apply one accounting payment to an approved invoice with PUT /Payments. The bank/payment-enabled account must belong to the selected tenant. This records an accounting payment; it does not transfer money through a bank. Amount is in invoice

23 Oct 2026 · 4 min read
Markdown ↗JSON ↗

Apply one accounting payment to an approved invoice with PUT /Payments. The bank/payment-enabled account must belong to the selected tenant. This records an accounting payment; it does not transfer money through a bank. Amount is in invoice currency and cannot exceed the provider outstanding balance. Scope accounting.payments. Reconciliation and explicit human approval belong before this action.

Inputs: tenantId, idempotencyKey, firstAttemptAt, payment. Outputs: payment, receipt, metadata. exec/next/error are control sockets. Throwing selects an explicitly wired error control route through ONF; data outputs are absent on that path.

Authentication: configure secret names, never literal credentials. Access-token mode reads XERO_ACCESS_TOKEN. Managed-refresh mode bootstraps once from XERO_OAUTH_BOOTSTRAP JSON containing access_token, refresh_token, expires_at; XERO_CLIENT_ID / XERO_CLIENT_SECRET hold client values. PKCE omits the secret. Rotated pairs are immediately CAS-persisted in encrypted workspace storage; a 60-second CAS lock serializes refresh. Never use the same refresh grant in different workspaces/namespaces/keys or another app. Do not inspect/export token records into logs. Crash between provider refresh and persistence needs recovery within Xero's documented refresh grace period. No tokens are returned.

Requests use fixed HTTPS Xero hosts, no redirect following, bounded 2 MB response and per-request timeout. Only explicit HTTP loopback mock origins are accepted as overrides. Read HTTP 429/5xx retries are bounded to readRetries (0..2) and Retry-After/maxRetryDelayMs; a longer wait fails with metadata in the safe error message. Network failures and accounting writes are never internally retried. Configure ONF instance retries deliberately; keep write retries disabled. Errors omit raw provider bodies to avoid credential/PII disclosure.

Validation: isolated local mock services only; live tenant consent and account access have not been verified. Xero accounting requests, OAuth tokens, tenant connections, idempotency, rate limits.

WRITE: allowWrites=true is required. Supply a stable domain idempotencyKey (1..128 chars) and the ORIGINAL firstAttemptAt. The node rejects firstAttemptAt older than five minutes; Xero retains keys for six minutes. Internal HTTP retries are zero. Reconcile uncertain completion through read operations before deliberate replay. Never generate a new key merely to bypass uncertainty. Xero applies business validation and tenant permissions.

Audited socket contract (21 October 2026)#

Inputs:

  • tenantId: string; required.
  • idempotencyKey: string; required.
  • firstAttemptAt: string; required.
  • payment: @xero.paymentWrite; required.

Outputs:

  • payment: @xero.payment; required.
  • receipt: @xero.writeReceipt; required.
  • metadata: @xero.metadata; required.

Configuration:

  • authMode: string; default "accessToken". accessToken reads a current bearer secret; managedRefresh keeps rotating tokens encrypted in workspace storage.
  • accessTokenSecret: string; default "XERO_ACCESS_TOKEN"
  • bootstrapTokenSecret: string; default "XERO_OAUTH_BOOTSTRAP". JSON secret containing access_token, refresh_token and expires_at (ISO time). Used only when the storage key does not exist.
  • clientIdSecret: string; default "XERO_CLIENT_ID"
  • clientSecretSecret: string; default "XERO_CLIENT_SECRET"
  • pkce: boolean; default false
  • tokenNamespace: string; default "integration.xero.oauth"
  • tokenKey: string; default "default"
  • mockBaseUrl: string; default "". Tests only: HTTP loopback origin. Production endpoints cannot be overridden.
  • requestTimeoutMs: integer; default 10000
  • readRetries: integer; default 1
  • maxRetryDelayMs: integer; default 2000
  • allowWrites: boolean; default false. Explicitly permit this accounting write. Keep ONF automatic retries disabled.

Known provider records and list elements have structural schemas. Explicit dynamic payloads, selected query results and provider extensions retain the recursive JSON Value vocabulary; they do not imply a known provider entity. Null is distinct from omission. Runtime validates the exact selected immutable type version; reading newer documentation never repins existing graphs. This audit used synthetic fixtures/local mocks and does not establish live provider authorization or delivery.

Catalog identity#

FieldValue
Source keyxero.payment.create
Kindnode
Familyxero
PackSee library discovery

Integration guide · Browse the catalog

Inputs#

Socket IDLabelTypeRequiredMeaning
execexeccontrolNo
tenantIdtenantIdstringYes
idempotencyKeyidempotencyKeystringYes
firstAttemptAtfirstAttemptAtstringYes
paymentpayment@xero.paymentWrite v1Yes

Outputs#

Socket IDLabelTypeRequiredMeaning
paymentpayment@xero.payment v1Yes
receiptreceipt@xero.writeReceipt v1Yes
metadatametadata@xero.metadata v1Yes
nextnextcontrolNo
errorerrorcontrolNo

Configuration schema#

json
{
  "type": "object",
  "properties": {
    "authMode": {
      "type": "string",
      "enum": [
        "accessToken",
        "managedRefresh"
      ],
      "default": "accessToken",
      "description": "accessToken reads a current bearer secret; managedRefresh keeps rotating tokens encrypted in workspace storage."
    },
    "accessTokenSecret": {
      "type": "string",
      "default": "XERO_ACCESS_TOKEN"
    },
    "bootstrapTokenSecret": {
      "type": "string",
      "default": "XERO_OAUTH_BOOTSTRAP",
      "description": "JSON secret containing access_token, refresh_token and expires_at (ISO time). Used only when the storage key does not exist."
    },
    "clientIdSecret": {
      "type": "string",
      "default": "XERO_CLIENT_ID"
    },
    "clientSecretSecret": {
      "type": "string",
      "default": "XERO_CLIENT_SECRET"
    },
    "pkce": {
      "type": "boolean",
      "default": false
    },
    "tokenNamespace": {
      "type": "string",
      "default": "integration.xero.oauth",
      "minLength": 1
    },
    "tokenKey": {
      "type": "string",
      "default": "default",
      "minLength": 1
    },
    "mockBaseUrl": {
      "type": "string",
      "default": "",
      "description": "Tests only: HTTP loopback origin. Production endpoints cannot be overridden."
    },
    "requestTimeoutMs": {
      "type": "integer",
      "minimum": 100,
      "maximum": 30000,
      "default": 10000
    },
    "readRetries": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2,
      "default": 1
    },
    "maxRetryDelayMs": {
      "type": "integer",
      "minimum": 0,
      "maximum": 10000,
      "default": 2000
    },
    "allowWrites": {
      "type": "boolean",
      "default": false,
      "description": "Explicitly permit this accounting write. Keep ONF automatic retries disabled."
    }
  },
  "required": [],
  "additionalProperties": false
}

Source and installed versions#

This reference describes the maintained source catalog snapshot, not a live export of your installation. Published definitions use immutable versions; installed graphs retain their exact pins. Discover and read the installed definition and selected version before wiring it. See versioning, connections and integration setup.

Source provenance

Reviewed against maintained source and topic documentation on 23 October 2026. This is a source snapshot; installed versions and provider access may differ.

  • ../OpenNodeFlow-Library/work/catalog-all.mjs
  • ../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs
  • ../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs
  • shared/seed.ts
  • shared/storage-library.ts
  • shared/variable-library.ts
  • shared/control-flow.ts
  • shared/remote-routes.ts
  • server/runtime-library.ts
  • shared/error-library.ts
  • shared/storage-model.ts
  • shared/builtin-documentation.ts
Type to search the documentation.
↑ ↓ to navigate · Enter to openAgent map ↗