Method

payment.openItems

An owner's open documents and pre-payments in an A/R or A/P account, in the order GnuCash's payment dialog applies them.

Lists what an owner has open in an A/R or A/P account: posted documents with a balance and pre-payments, in the order GnuCash's payment dialog applies them (by due date). Pass the GUIDs it gives, in this order, as applyTo of payment.process to pay as the dialog would.

balance is signed as on the account: a customer's unpaid invoice is positive and a pre-payment is negative; for a vendor it is the other way round. invoice and id are null for a pre-payment, whose type is Pre-Payment.

Examples

Example: with a copy of the synthetic/business-editable example book open as book.gnucash.

JSON-RPC

Request:

{"jsonrpc":"2.0","id":1,"method":"payment.openItems","params":{"owner":{"type":"customer","id":"5b22073fa4e34411b07c14a77147ce6b"},"account":"Assets:Receivable"}}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "items": [
      {
        "lot": "83f95c95c93e444f8941d784bff4de2c",
        "invoice": "aa210b7131de44c48b8513cd27c00e95",
        "id": "000001",
        "type": "Invoice",
        "balance": {
          "num": "87300",
          "denom": "100"
        },
        "…": "…"
      }
    ]
  }
}

Command line

red-ale exec --book book.gnucash payment.openItems '{"owner":{"type":"customer","id":"5b22073fa4e34411b07c14a77147ce6b"},"account":"Assets:Receivable"}'

It prints:

{
  "items": [
    {
      "lot": "83f95c95c93e444f8941d784bff4de2c",
      "invoice": "aa210b7131de44c48b8513cd27c00e95",
      "id": "000001",
      "type": "Invoice",
      "balance": {
        "num": "87300",
        "denom": "100"
      },
      "…": "…"
    }
  ]
}

MCP tool call

Tool call:

{"name":"payment.openItems","arguments":{"owner":{"type":"customer","id":"5b22073fa4e34411b07c14a77147ce6b"},"account":"Assets:Receivable"}}

Result:

{
  "structuredContent": {
    "items": [
      {
        "lot": "83f95c95c93e444f8941d784bff4de2c",
        "invoice": "aa210b7131de44c48b8513cd27c00e95",
        "id": "000001",
        "type": "Invoice",
        "balance": {
          "num": "87300",
          "denom": "100"
        },
        "…": "…"
      }
    ]
  }
}

Effect: read.

Params

Params of payment.openItems.

  • owner (OwnerParam, required): A customer, vendor or employee.
  • account (AccountRef, required): The A/Receivable or A/Payable account.

Result

Result of payment.openItems.

  • items (array of OpenItem, required): In the order GnuCash's payment dialog hands chosen items to the engine.