訂單

這一頁從系統實際的 tool 產生。授權項目是權杖要勾的項目;「核可」是 Agent 呼叫之後要不要等人在網站上核可。

order_cancel

寫入核可:看情況這張請款單(或訂單的任一張請款單)寄出過要人核可。

取消訂單,和它還沒取消的請款單。

給 Agent 的原文

Cancel an order and all its bills that are not cancelled yet.

參數

名稱型別必填說明
orderstring必填Order number (OD-000001) or id
reasonstring必填
idempotency_keystring必填Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again.

授權項目:orders:cancel

order_create

寫入可試算核可:不用

成立訂單;issue_bill(預設 true)同時開一張全額的請款單,false 只成立訂單(之後用 bill_create 請款)。可以先試算看金額和到期日,不會建立任何東西。

給 Agent 的原文

Create an order; issue_bill (default true, needs bills:create) also issues a bill for the full amount, false creates the order only (bill it later with bill_create). Use dry_run to see the amounts and due date first without creating anything.

參數

名稱型別必填說明
itemsItem[]必填
items[].namestring必填
items[].unit_pricestring必填Amount as a string, e.g. "12000" or "12.50"
items[].quantityintegerdefault: 1
items[].discountDiscount(可以是 null)
items[].descriptionstring
items[].refstringItem code in an external system
currencystring(可以是 null)Empty uses the default currency of the workspace
localestring(可以是 null)
tax_includedbooleandefault: true
tax_typeTAXABLE | ZERO_RATED | EXEMPTdefault: "TAXABLE"
buyerBuyer(可以是 null)
buyer.legal_namestringEmpty uses the customer name
buyer.tax_idstring
buyer.addressstring
buyer.primary_emailstring
buyer.cc_emailsstring[]default: []
notesstring(可以是 null)Empty uses the default notes of the locale
customerCustomer(可以是 null)Required unless customer_id is given, also for dry_run (missing returns VALUE_REQUIRED, field customer.name)
customer.namestring必填
customer.refstringCustomer code in an external system; only stored and used for filtering
customer_idstring(可以是 null)Customer number or id (needs customers:read): customer and buyer fields you leave out are filled from the customer
issue_billbooleanAlso issue a bill for the full amount (needs bills:create); false creates the order only default: true
due_datedate(可以是 null)Due date of the bill; empty uses the default payment term; not allowed with issue_bill: false
agent_notestring
metadataMetadataEntry[](可以是 null)
metadata[].keystring必填
metadata[].valuestring必填
online_paymentboolean(可以是 null)Omitted: true when the workspace has an active payment gateway
bank_transferBankTransfer(可以是 null)Omitted uses the bank transfer in settings; null means no bank transfer
bank_transfer.bank_codestring必填
bank_transfer.account_numberstring必填
bank_transfer.account_namestring必填
bank_transfer.bank_namestring
bank_transfer.branchstring
dry_runbooleandefault: false
idempotency_keystringRequired for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again.

授權項目:orders:create;issue_bill 是 true(沒帶也是)時,另外要 bills:create;帶 customer_id 從客戶帶入資料時,另外要 customers:read。

order_get

核可:不用

用編號(OD-000001)或 id 查一張訂單,附 version 和 allowed_actions。

給 Agent 的原文

Get one order by number (OD-000001) or id, with its version and allowed_actions.

參數

名稱型別必填說明
orderstring必填Order number (OD-000001) or id

授權項目:orders:read

核可:不用

查訂單,新的在前;回摘要,要一張訂單和它的請款單用 order_get。

給 Agent 的原文

Search orders, newest first. Returns summaries; use order_get for one order and its bills.

參數

名稱型別必填說明
limitinteger1 to 100 default: 20
cursorstring(可以是 null)next_cursor from the previous page
keywordstringPart of the order/bill number or customer name; an email or phone needs pii:read
item_namestring
customer_refstring(可以是 null)
statusCONFIRMED | CANCELLED(可以是 null)
created_fromdate(可以是 null)
created_todate(可以是 null)
billing_statusUNBILLED | PARTIALLY_BILLED | BILLED[](可以是 null)Any of these billing statuses (cancelled orders match none)

授權項目:orders:read;keyword 像 Email 或電話時,另外要 pii:read。

order_send

寫入可試算核可:不用寄出前要先試算帶確認碼

寄訂單確認信給訂單上的買方:品項、金額、付款方式和每張請款單的連結。寄出前要先試算,把結果給使用者看、問過使用者,再帶試算給的確認碼寄。

給 Agent 的原文

Email an order confirmation to the buyer on the order (primary email and CC): items, totals, payment methods and bank transfer details, and a link to each bill of the order that is not cancelled. No attachment. Cancelled orders cannot be sent. Before sending, call with dry_run: true, show the user the order, bills and recipients, and ask whether to send; then call again with the confirmation_code from the dry run.

參數

名稱型別必填說明
orderstring必填Order number (OD-000001) or id
messagestringA note added to the email, up to 1,000 characters
dry_runbooleandefault: false
confirmation_codestring(可以是 null)Required unless dry_run is true: the confirmation_code returned by a dry run with the same parameters.
idempotency_keystringRequired for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again.

授權項目:orders:send

order_update

寫入核可:不用

改訂單的客戶、買方、備註和付款方式(有請款單付清或開了發票就不能改),要帶 order_get 拿到的 version。

給 Agent 的原文

Change the customer, buyer, notes and payment options of an order (not when a bill is paid or an e-invoice is issued). Send the version from order_get.

參數

名稱型別必填說明
orderstring必填Order number (OD-000001) or id
versioninteger必填
customerCustomer必填
customer.namestring必填
customer.refstringCustomer code in an external system; only stored and used for filtering
buyerBuyer必填
buyer.legal_namestringEmpty uses the customer name
buyer.tax_idstring
buyer.addressstring
buyer.primary_emailstring
buyer.cc_emailsstring[]default: []
notesstring必填
online_paymentboolean必填
bank_transferBankTransfer(可以是 null)必填
bank_transfer.bank_codestring必填
bank_transfer.account_numberstring必填
bank_transfer.account_namestring必填
bank_transfer.bank_namestring
bank_transfer.branchstring
idempotency_keystring必填Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again.

授權項目:orders:update、pii:read

order_update_agent_data

寫入核可:不用

換掉訂單上給 agent 用的備註和 metadata;網站、PDF、分享頁都不顯示,不用帶 version。

給 Agent 的原文

Replace the agent note and metadata of an order. Not shown on the website, PDF or share page; no version needed.

參數

名稱型別必填說明
agent_notestring必填
metadataMetadataEntry[]必填
metadata[].keystring必填
metadata[].valuestring必填
orderstring必填Order number (OD-000001) or id
idempotency_keystring必填Required for every call that writes (not for dry_run). The same key within 24 hours returns the first result instead of doing it again.

授權項目:orders:update