# Pay a supplier

URL: /systems/finance/pay-a-supplier · Id: `guide:pay-a-supplier`

> Say "pay this bill when it is due" and get the bill read and filed, an approval, a bank payment on the due date and the payment matched in your books.

Pay a supplier's [Bill](/business/nouns/bill) from the operating account on its due date, once an approver accepts it.

Needs: [Open a bank account](/systems/finance/open-a-bank-account)

**Before real money moves**

- Who says yes: You. Your agent shows you the run and waits for your [Approval](/business/nouns/approval).
- You leave the chat: Never: it all happens in the chat.

## What you get
- 1 bill read from the supplier’s invoice and filed to the right account (Bill)
- 1 supplier on record with its bank (Organization)
- 1 approval from whoever may approve that amount (Approval)
- 1 payment on the due date, by bank transfer or wire (Transaction)
- 2 lines in your books: money you owe, then cash out once paid (Entry)
- 1 bank payment matched to the bill (Transaction)

## Your agent does
**For agents**

- Guide: `guide:pay-a-supplier`, status `beta`. Page: [/systems/finance/pay-a-supplier.md](/systems/finance/pay-a-supplier.md).
- Approval: ask the founder first. Show the run, then wait for their Approval; a refusal ends it.
- Leaves the chat: never.
- Needs first: [Open a bank account](/systems/finance/open-a-bank-account).
- Run: call the steps in order, each through the API, SDK, CLI or MCP tab below; a later step passes the `$id` an earlier one returns. Each value marked example is the sample business’s: pass the founder’s own.

| Step | Verb | Inputs (type, required, this guide’s value) | Returns |
| --- | --- | --- | --- |
| 1 | [`Bill.create`](/business/nouns/bill/create) (`verb:Bill.create`) | `organization` Organization (an id), required: example `"organization_northwind"`; `amount` money, required: example `{"amount":29,"currency":"USD"}`; `dueOn` date, required: example `"2026-11-15"`; `account` string: example `"expense.hosting"` | `bill` Bill |
| 2 | [`Bill.approve`](/business/nouns/bill/approve) (`verb:Bill.approve`) | `bill` Bill (an id), required: the `$id` step 1 returns | `bill` Bill |
| 3 | [`Bill.pay`](/business/nouns/bill/pay) (`verb:Bill.pay`) | `bill` Bill (an id), required: the `$id` step 1 returns | `transaction` Transaction, `bill` Bill |

Returns: the last call answers with `transaction`, `bill` and its `action`, whose `status` is `done`, `pending` (waiting on an Approval or a Worker), `failed`, `canceled` or `refused`:

```json
{
  "api": "https://api.sb/leaseline.app",
  "transaction": {
    "$id": "https://api.sb/leaseline.app/transactions/transaction_1",
    "$type": "Transaction"
  },
  "bill": {
    "$id": "https://api.sb/leaseline.app/bills/bill_1",
    "$type": "Bill",
    "organization": "organization_northwind",
    "amount": {
      "amount": 29,
      "currency": "USD"
    },
    "dueOn": "2026-11-15",
    "account": "expense.hosting",
    "status": "paid"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_1",
    "operation": "Bill.pay",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/action_1"
  }
}
```

Next: offer “Pay it today”, or “Pay every Northwind bill under $500 without asking me”.

Calls: `Bill.create` → `Bill.approve` → `Bill.pay`

Ask:

```text
Pay a supplier’s bill on its due date.
Pay Northwind’s $29 invoice for hosting.
Approve and pay the supplier bills due this week.
```

API:

```bash
# 1. Bill.create
BILL=$(curl -X POST https://api.sb/leaseline.app/bills \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"organization":"organization_northwind","amount":{"amount":29,"currency":"USD"},"dueOn":"2026-11-15","account":"expense.hosting"}' | jq -r '.bill["$id"] | split("/") | last')

# 2. Bill.approve
curl -X POST https://api.sb/leaseline.app/bills/$BILL/approve \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"

# 3. Bill.pay
curl -X POST https://api.sb/leaseline.app/bills/$BILL/pay \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

SDK:

```ts
import { $ } from 'startup-builder'

const bill = await $.Bill.create({ organization: 'organization_northwind', amount: { amount: 29, currency: 'USD' }, dueOn: '2026-11-15', account: 'expense.hosting' })
await $.Bill.approve({ bill: bill.$id })
await $.Bill.pay({ bill: bill.$id })
```

CLI:

```bash
BILL=$(npx startup-builder do Bill.create --json '{"organization":"organization_northwind","amount":{"amount":29,"currency":"USD"},"dueOn":"2026-11-15","account":"expense.hosting"}' | jq -r '.bill["$id"] | split("/") | last')
npx startup-builder do Bill.approve --json '{"bill":"'"$BILL"'"}'
npx startup-builder do Bill.pay --json '{"bill":"'"$BILL"'"}'
```

MCP:

```json
{
  "name": "do",
  "arguments": {
    "code": "const bill = await $.Bill.create({ organization: 'organization_northwind', amount: { amount: 29, currency: 'USD' }, dueOn: '2026-11-15', account: 'expense.hosting' })\nawait $.Bill.approve({ bill: bill.$id })\nreturn await $.Bill.pay({ bill: bill.$id })"
  }
}
```

## Change it
- Pay it today.
- Pay every Northwind bill under $500 without asking me.
- Pay half now and half next month.

## Under the hood
- Systems: [Spend management](/systems/spend), [Treasury](/systems/treasury), [Ledger](/systems/ledger), [Work queue](/agents/work-queue)
- Nouns: [Bill](/business/nouns/bill), [Organization](/business/nouns/organization), [Approval](/business/nouns/approval), [Entry](/business/nouns/entry), [Transaction](/business/nouns/transaction)
- Events: `Bill.created`, [`Bill.approved`](/business/events/Bill.approved), [`Bill.paid`](/business/events/Bill.paid), [`Transaction.reconciled`](/business/events/Transaction.reconciled)
- Stripe objects: `Treasury OutboundPayment`, `Treasury Transaction`

The supplier is an [Organization](/business/nouns/organization) on record with its bank. [`Bill.pay`](/business/nouns/bill/pay) holds any Bill whose bank differs from that record, whatever its amount, until the change is confirmed through a second channel.