Expected payments: money you expect to receive (or to be debited), which Modern Treasury matches against bank transactions to reconcile them. Give amount and date ranges (amount_lower_bound, amount_upper_bound, date_lower_bound, date_upper_bound) and optional reconciliation_rule_variables; Modern Treasury marks the expected payment reconciled when a transaction matches and sends an expected_payment.reconciled webhook.

Functions

create-expected-payment

fn (params: Map): Map
fn (params: Map, opts: Map): Map

POST /api/expected_payments: expect a payment. Common params: internal_account_id, direction ("credit" for money in), type, currency, amount_lower_bound, amount_upper_bound, date_lower_bound, date_upper_bound, counterparty_id, description, statement_descriptor, remittance_information, metadata, line_items, reconciliation_rule_variables, reconciliation_filters, ledger_transaction.

Example

::modern-treasury::expected-payments/create-expected-payment({
  internal_account_id: "0f8e3719-3dfd-4613-9bbf-c0333781b59f",
  direction: "credit",
  type: "ach",
  amount_lower_bound: 10000,
  amount_upper_bound: 10000,
  date_lower_bound: "2026-11-01",
  date_upper_bound: "2026-11-05",
  description: "Invoice 42"
}, {idempotency-key: "invoice-42-expected"})

delete-expected-payment

fn (expected-payment-id: Str): Any
fn (expected-payment-id: Str, opts: Map): Any

DELETE /api/expected_payments/{id}: archive an expected payment so it no longer reconciles.

get-expected-payment

fn (expected-payment-id: Str): Map
fn (expected-payment-id: Str, opts: Map): Map

GET /api/expected_payments/{id}: retrieve an expected payment, with its status (unreconciled, partially_reconciled, reconciled, archived) and transaction_id once matched.

list-expected-payments

fn (): Map
fn (params: Map): Map
fn (params: Map, opts: Map): Map

GET /api/expected_payments: one page. Filters: status, type, direction, internal_account_id, counterparty_id, external_id, created_at_lower_bound, created_at_upper_bound, updated_at_lower_bound, updated_at_upper_bound, metadata, per_page, after_cursor.

reconcile-expected-payment

fn (expected-payment-id: Str): Map
fn (expected-payment-id: Str, opts: Map): Map

Mark an expected payment reconciled by hand (PATCH {status: "reconciled"}), when you have matched it yourself.

update-expected-payment

fn (expected-payment-id: Str, params: Map): Map
fn (expected-payment-id: Str, params: Map, opts: Map): Map

PATCH /api/expected_payments/{id}: change the bounds, description, metadata or rule variables of an unreconciled expected payment.