File a pending supplier-payment draft (human approves in Taokeh)
create_payment_draftFiles a pending supplier-payment draft ("we paid Ah Seng RM5,000 from Maybank on Tuesday against bills 12 and 14"), which raises its payment voucher. Only the owner's approval writes the bank payment and settles the bills, moving payables and the bank as a match in Banking would, and numbers the payment voucher (the next PV number, dated as the payment, naming who prepared and who approved it); until then it prints unnumbered, marked not yet approved (voucherPreviewUrl, opened in Taokeh). It settles an existing supplier's open bills (supplier from resolve_vendor; bills from ap_aging or search_documents), by a lump total (allocated oldest first) or per-bill allocations. A supplier's bill number is not unique, so a reference matching two open bills is refused naming both; purchaseId is exact. MYR only: a foreign-currency bill is refused (Banking → Match handles the exchange difference). Amounts are ringgit, as ap_aging shows them. A payment dated before a bill it pays is an advance that pays the bill on the bill's date (paidBeforeBill in the result); dated on or before the accounting start date, it never settles an opening bill. A credit card cannot be the paying account; card spending arrives on the card's own statement. A payment matching an imported bank line still awaiting review (the given bankAccountId, same amount, within 3 days) is filed but flagged for review, with a warning naming the line, as the same money would count twice; its allocation is proposed on that line by draft_bank_classification. Outstanding is net of live debit notes, and a lump total fills net figures; an explicit amount may reach the bill's open amount before debit notes, leaving the excess as the supplier's refundable credit. Allocation is re-derived at filing and at approval, so a bill settled meanwhile makes the draft refuse. A filed draft is changed with revise_draft (kind 'payment'). Payment proof rides the draft as on create_receipt_draft.
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": {
"paymentDate": "<paymentDate>"
},
"name": "create_payment_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | A short reviewer note in the reviewer's language naming what to double-check before approving (a smudged total, an uncertain party, a judgment call). Shown on a small approval card; empty when nothing needs flagging. | |
| total | No | A lump ringgit amount allocated oldest first across the supplier's open bills. Either this or `allocations`. | |
| vendor | No | The supplier name, matched against existing suppliers (as resolve_vendor does). No supplier is created. | |
| vendorId | No | The resolved vendor id, instead of the name. | |
| allocations | No | The explicit per-bill split, at most 50 lines. Each amount is capped by the server at that bill’s live open amount before its debit notes. | |
| needsReview | No | ||
| paymentDate | Yes | ||
| printedTotal | No | The total printed on the payment advice, if any. Cross-check only — the server computes the real total and flags a mismatch on the approval screen. | |
| bankAccountId | No | The paying bank or cash account (intake_contract(doc_type:'payment') → payingAccounts). Optional; without it the reviewer picks at approval. A credit-card account is refused by name. | |
| attachmentBytes | No | Decoded byte size of the original file. Sent with attachmentBase64, it lets the server refuse a truncated paste instead of filing a corrupt file. | |
| attachmentToken | No | The token from request_attachment_upload, once the file bytes have been PUT to its uploadUrl; it carries a photo or PDF of any size without base64. Not combined with attachmentBase64. The file lands on the settlement entry on approval. | |
| attachmentBase64 | No | The original payment proof (transfer slip, remittance advice) as base64, for small files (a few KB); a photo or multi-page PDF goes through request_attachment_upload and `attachmentToken`. A bad type or oversize file is refused and nothing is filed. | |
| attachmentSha256 | No | SHA-256 of the original file as 64 hex characters: an optional second integrity check on attachmentBase64. | |
| attachmentFilename | No | Optional original filename for the attachment, e.g. transfer-slip.jpg. | |
| attachmentMediaType | No | The attachment's media type, e.g. 'image/jpeg' or 'application/pdf'. Required with attachmentBase64; a type that does not match the file's bytes is refused and nothing is filed. |