Skip to main content
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"
  }
}

Authorizations

Authorization
string
header
required

使用 Laravel Sanctum Token 進行認證。

Token 可在商家後台的「API 設定」頁面取得。

Headers

X-Idempotency-Key
string

冪等鍵(24 小時內有效)

Body

application/json
order_no
string
required

訂單編號(商家內唯一)

Example:

"ORD-20260109-001"

amount
string
required

訂單金額

Example:

"990.00"

customer_email
string<email>
required

客戶 Email(不存在會自動建立客戶)

status
enum<string>
default:pending

訂單狀態

Available options:
pending,
paid,
failed,
refunded,
cancelled
customer_name
string

客戶姓名(建立新客戶時使用)

currency
string
default:TWD

幣別,使用 ISO 4217 貨幣代碼。預設為 TWD(新台幣)。

常見幣別:

代碼說明
TWD新台幣
USD美元
JPY日圓
HKD港幣
SGD新加坡幣
CNY人民幣
KRW韓元
MYR馬來西亞令吉
THB泰銖
EUR歐元
GBP英鎊
Example:

"TWD"

payment_method
enum<string>

付款方式。支援以下選項:

說明
credit_card信用卡
atmATM 轉帳
cvs超商繳費(代碼繳費)
line_payLINE Pay
jkopay街口支付
apple_payApple Pay
Available options:
credit_card,
atm,
cvs,
line_pay,
jkopay,
apple_pay
Example:

"credit_card"

billing_cycle
enum<string>

訂閱週期(影響 MRR 計算)

Available options:
monthly,
quarterly,
semi-annual,
yearly,
one-time
paid_at
string<date-time>

付款時間(若未提供且 status 為 paid,系統自動填入當前時間)

refunded_at
string<date-time>

退款時間(若未提供且 status 為 refunded,系統自動填入當前時間)

failed_at
string<date-time>

付款失敗時間(若未提供且 status 為 failed,系統自動填入當前時間)

metadata
object

自訂欄位

Response

訂單建立成功

data
object