Pending draft: match a posted payment to open invoices or bills (human approves in Taokeh)
create_payment_match_draftFILES A PENDING DRAFT ONLY — NOTHING CHANGES UNTIL A HUMAN REVIEWS AND APPROVES IT IN TAOKEH. Propose how ONE bank line already posted as a customer payment (money in) or a supplier payment (money out) settles open invoices or bills — the owner's "this deposit paid these three invoices". An admin or bookkeeper reviews it and approves; only that tap allocates, exactly as Banking → Match → Save does, and the documents then read as paid. Pass bankTransactionId (a POSTED line from bank_review_queue with status "posted") and allocations: [{saleId, amount}] for money in, [{purchaseId, amount}] for money out, ringgit, adding up to the WHOLE line to the sen (the in-app pane's ±0.10 rounding allowance does not apply to a proposal). At most 50 documents. WHICH DOCUMENTS: only the ones Banking → Match offers this line — the open invoices of the customer the line is posted against (or, when that customer has none open, the invoices of the company's walk-in customer — the one the owner marked on its customer page, else a customer named 'CASH SALES'), or the supplier's open bills. A line with no customer at all is offered nothing. A document of ANY other party is refused, because no screen in Taokeh offers it: if the payment was posted against the wrong customer, or no customer, the owner unposts the line in Banking, sets the right customer, and posts it again — then file this. A refusal lists the documents the line can take, with their ids. ALSO REFUSED BY NAME, at filing and again at approval: a line not posted, not a customer/supplier payment, already matched (a match someone saved is never replaced — that includes a line applied only IN PART: the rest of it is applied in-app, on Banking → Match or Sales → Official receipts → Receive payment, never by this draft), or on a foreign-currency account (Taokeh does not post or match those lines yet); a line whose posted entry booked an exchange difference on a foreign-currency invoice or bill (the owner unposts it in Banking, then matches it and posts it again); a document not open; an amount over what a document still owes; a FOREIGN-currency invoice or bill dated after the payment (it is matched by hand on Banking → Match); an OPENING invoice or bill paid by a line dated on or before the accounting start date (the opening balance already counts that money); a match whose line AND document are both dated on or before the lock date (it would apply inside the locked period, whose books are filed: an admin unlocks in Opening balances → Review & lock, matches, then locks again); the same document twice; a pending match already filed for the line. A ringgit INVOICE or BILL dated after the payment is allowed — a customer's deposit, or an advance paid to a supplier: the money sits on that party's account until the document's date and pays it then, and the review page and this answer (paidBeforeInvoice / paidBeforeBill) say so. If the line or a document changes before approval (paid, credited, re-tagged, matched), approval refuses and nothing is allocated. A payment holding an official receipt (recorded with Receive payment) can only pay that customer's invoices — never the walk-in customer's or anyone else's; to move it, the owner undoes it in Banking and records it again. note: one short line for the owner saying how you know (the remittance, the customer's message). A supplier DEBIT NOTE's credit used as a negative line here is refused when the bank line is dated before the debit note (its credit did not exist yet). And approving a new allocation that takes money OFF a bill is refused while one of that bill's debit notes has credit above what the bill owed that was already refunded or used on another payment — the refusal names the note; that refund or payment is undone first, in Taokeh.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"bankTransactionId": "<bankTransactionId>",
"allocations": "<allocations>"
},
"name": "create_payment_match_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | A SHORT note for the owner: how you know which documents it paid. | |
| lines | No | NOT a filter on this tool. Pass the documents as `allocations`: [{saleId or purchaseId, amount}]. | |
| notes | No | NOT a filter on this tool. Pass the owner note as `note`. | |
| bankLineId | No | NOT a filter on this tool. Pass the bank line as `bankTransactionId`. | |
| allocations | Yes | Where the money goes. An unknown key is refused by name. | |
| needsReview | No | Set true when something gave you pause. | |
| transactionId | No | NOT a filter on this tool. Pass the bank line as `bankTransactionId`. | |
| bankTransactionId | Yes | REQUIRED — the posted bank line, from bank_review_queue (status "posted"). |