HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update Order

Function

To update order data
更新訂單資訊

To update reference user id of the third party
儲存第三方訂單ID

To update order's tracking information (Only reserved for customized delivery options )
更新訂單追蹤資訊(只開放給自訂/非第三方串接物流之送貨方式使用)

📘

After return_order_revamp feature key on/啟用「return_order_revamp」功能後

  • 訂單狀態已完成,不可更新運送資訊/運送地址資訊/物流追蹤資訊。

URL

PATCH <<api_domain>>/v1/orders/:id

Request Parameters

ParameterTypeDescriptionExample
id
*Required
StringOrder's ID
訂單ID
5b2b66599a76f0196a000a54
tagsArrayOrder's Tags
訂單標籤
["TAG-001", "TAG-002"]
tracking_numberStringDelivery Tracking Number
物流追蹤號碼
"tracking_number":"66827510120656"
tracking_urlStringDelivery Tracking url
物流追蹤url
"tracking_url":"http://www.dhl.com/tracking"
delivery_provider_nameHashDelivery Provider Name
物流提供者名稱
ruby "delivery_provider_name": { "zh-hant": "DHL", "en": "DHL" }
ref_order_idStringFor third party custom order id
可供儲存第三方訂單ID
-
如果要將"ref_order_id"清除,需要帶入 nil or null
不可以填入空字串""
"ref_order_id":"ORD001"
delivery_dataOrder DeliveryDataDelivery Data
運送資訊

Able to update the fields below
可修改以下欄位
- location_code
- location_name
- store_address
- recipient_name
- recipient_phone
"delivery_data":{ "location_code":"F004507", "location_name":"全家木興店1", "store_address":"台北市文山區木柵路二段52號1", "recipient_name":"Sheryl", "recipient_phone":"0987654321" }
delivery_addressOrder DeliveryAddressDelivery Address Information
運送地址資訊

Able to update the fields below
可修改以下欄位
- country
- country_code
- address_1
- address_2
- city
- state
- postcode
"delivery_address":{ "address_1": "1/F, Some Building", "address_2": "No. 123 Some Street, Somewhere", "city": "City", "state": "Perak", "postcode":"36500", "country": "Malaysia", "country_code":"MY" }
custom_dataArrayCustom data
自定義資料
"custom_data": [{ "value": "field value", "field_id": "field_id" }]

Request Example

curl -X PATCH \
  <<api_domain>>/v1/orders/5b2b66599a76f0196a000a54 \
  -H 'Accept: application/json' \
  -H 'Authorization: access_token' \
  -H 'Content-Type: application/json' \
  -d '{
    "tracking_number": "66827510120656",
    "tracking_url": "http://www.dhl.com/tracking",
    "delivery_provider_name": {
      "zh-hant": "DHL",
      "en": "DHL"
    },
    "tags": [
    	"tags-00",
      "tags-01"
    ],
    "delivery_data": {
      "location_code": "F004507",
      "location_name": "全家木興店1",
      "store_address": "台北市文山區木柵路二段52號1",
      "recipient_name": "Sheryl",
      "recipient_phone": "0987654321"
    },
    "delivery_address": {
      "address_1": "1/F, Some Building",
      "address_2": "No. 123 Some Street, Somewhere",
      "city": "City",
      "state": "Perak",
      "postcode":"36500",
      "country": "Malaysia",
      "country_code":"MY"
    }
  }'

Response Field

The same as Get Order

Response Example

The same as Get Order