curl --request POST \
--url https://api.zangsho.com/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_no": "ORD-20260109-001",
"amount": "990.00",
"status": "paid",
"customer_email": "customer@example.com",
"customer_name": "王小明",
"currency": "TWD",
"payment_method": "credit_card",
"billing_cycle": "monthly",
"paid_at": "2026-01-09T08:00:00Z"
}
'{
"data": {
"id": 123,
"order_no": "<string>",
"amount": "<string>",
"currency": "TWD",
"status": "pending",
"payment_method": "credit_card",
"source": "api",
"billing_cycle": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"refunded_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"metadata": {},
"customer_email": "<string>",
"customer_name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required.",
"The email must be a valid email address."
]
}
}訂單 Orders
建立訂單
建立單一訂單。
Webhook 觸發
- 建立成功時觸發
order.created事件 - 若 status 為
paid,同時觸發order.paid事件
時間戳記自動填入
若建立訂單時指定了 status 但未提供對應的時間欄位,系統會自動填入當前時間:
status: paid→ 自動填入paid_atstatus: refunded→ 自動填入refunded_atstatus: failed→ 自動填入failed_at
如果你已提供時間欄位(例如匯入歷史資料時),系統不會覆蓋你提供的值。
冪等處理
可透過 X-Idempotency-Key header 實現冪等,重複請求會回傳相同結果。
POST
/
orders
curl --request POST \
--url https://api.zangsho.com/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_no": "ORD-20260109-001",
"amount": "990.00",
"status": "paid",
"customer_email": "customer@example.com",
"customer_name": "王小明",
"currency": "TWD",
"payment_method": "credit_card",
"billing_cycle": "monthly",
"paid_at": "2026-01-09T08:00:00Z"
}
'{
"data": {
"id": 123,
"order_no": "<string>",
"amount": "<string>",
"currency": "TWD",
"status": "pending",
"payment_method": "credit_card",
"source": "api",
"billing_cycle": "<string>",
"paid_at": "2023-11-07T05:31:56Z",
"refunded_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"metadata": {},
"customer_email": "<string>",
"customer_name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"message": "Unauthenticated."
}{
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required.",
"The email must be a valid email address."
]
}
}Authorizations
Body
application/json