注文API

注文の取得、ステータス更新、配送管理を行います。

エンドポイント
GET

/orders

orders:read

ページネーション付きの注文リストを取得します。ステータスと日付範囲によるフィルタリングをサポートしています。

GET

/orders/:id

orders:read

すべての明細と配送詳細を含む単一の注文を取得します。

PUT

/orders/:id/status

orders:write

注文のステータスを更新します(例:出荷済みとしてマーク)。

POST

/orders/:id/shipment

orders:write

注文に配送追跡情報を添付します。

フィールドリファレンス
フィールド必須説明

id

string

いいえ

一意の注文識別子(読み取り専用)

orderNumber

string

いいえ

読みやすい注文番号(読み取り専用)

customerId

string

いいえ

顧客ID(ゲスト注文では不在)

status

string

いいえ

PENDING、CONFIRMED、PROCESSING、SHIPPED、DELIVERED、CANCELLED、REFUNDED

paymentStatus

string

いいえ

pending、paid、refunded、failed

paymentMethod

string

いいえ

使用された支払い方法(例:stripe、cod)

total

integer

いいえ

合計金額(セント単位、読み取り専用)

items

OrderLine[]

いいえ

明細の配列(読み取り専用)

shippingAddress

Address

いいえ

配送先住所オブジェクト

fulfillmentType

string

いいえ

shipping、pickup、delivery、または digital

createdAt

datetime

いいえ

ISO 8601タイムスタンプ(読み取り専用)

updatedAt

datetime

いいえ

ISO 8601 タイムスタンプ(読み取り専用)

クエリパラメータ(リスト)
フィールド必須説明

page

integer

いいえ

ページ番号(デフォルト:1)

limit

integer

いいえ

1ページあたりのアイテム数(デフォルト:20、最大:100)

使用例
最近の注文を一覧表示
bash
curl "https://api.mercozy.com/api/v1/external/orders?page=1&limit=10" \
  -H "X-API-Key: mk_live_your_key_here"
注文ステータスを更新
bash
curl -X PUT "https://api.mercozy.com/api/v1/external/orders/ord_abc123/status" \
  -H "X-API-Key: mk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "shipped"
  }'
配送追跡を作成
bash
curl -X POST "https://api.mercozy.com/api/v1/external/orders/ord_abc123/shipment" \
  -H "X-API-Key: mk_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "carrier": "fedex",
    "trackingNumber": "7489236401",
    "trackingUrl": "https://www.fedex.com/track?id=7489236401"
  }'