---
# System prepended metadata

title: Order API

---

# Order API

### Get Active Created Orders

#### Response

| Name   | Type          | Description                                        |
| ------ | ------------- | -------------------------------------------------- |
| orders | list< Order > | 訂單ID，範例：f9f363d1-e1c2-4595-b477-c649845bc953 |

#### Response - Order

| Name          | Type         | Description                                                 |
| ------------- | ------------ | ----------------------------------------------------------- |
| Id            | string       | UberEat的訂單ID，範例：f9f363d1-e1c2-4595-b477-c649845bc953 |
| current_state | string(enum) | 一律顯示 CREATED                                            |
| placed_at     | string       | 訂單成立時間，範例：2019-09-23T16:20:11Z                    |

### Get Latest Canceled Orders

#### Response

| Name   | Type          | Description                    |
| ------ | ------------- | ------------------------------ |
| orders | list< Order > | 取得所有狀態為 CANCELED 的訂單 |

#### Response - Order

| Name          | Type         | Description                                                 |
| ------------- | ------------ | ----------------------------------------------------------- |
| Id            | string       | UberEat的訂單ID，範例：f9f363d1-e1c2-4595-b477-c649845bc953 |
| current_state | string(enum) | 一律顯示 CANCELED                                           |
| placed_at     | string       | 訂單成立時間，範例：2019-09-23T16:20:11Z                    |

### Get Order Details

#### Response - Order

| Name                  | Type                | Description                                                  | Database Column                                       |
| --------------------- | ------------------- | ------------------------------------------------------------ | ----------------------------------------------------- |
| id                    | string              | 訂單ID，範例：f9f363d1-e1c2-4595-b477-c649845bc953           | dudoo_client.sales.sale_id                            |
| display_id            | string              | 顯示在畫面上的訂單編號末五碼，範例：BC953                    | dudoo_client.sales.form_no                            |
| external_reference_id | string              |                                                              |                                                       |
| current_state         | string (**enum**)   | 訂單目前狀態：CREATED, ACCEPTED, DENIED, FINISHED, CANCELED  | dudoo_client.orders.type, dudoo_client.orders.message |
| type                  | string (**enum**)   | 餐點目前的狀態：PICK_UP, DINE_IN, DELIVERY_BY_UBER, DELIVERY_BY_RESTAURANT | dudoo_client.sales.type                               |
| store                 | Store(**Object**)   | 收單門店, 當訂單建立時webhook會給                            | dudoo_client.sales.company_id                         |
| eater                 | Eater(**Object**)   | 訂購人姓名：first_name, last_name                            | dudoo_client.sales.name                               |
| cart                  | Cart(**Object**)    | 購物內容，乘載消費者購買的項目                               | Ref. Response - Cart                                  |
| payment               | Payment(**Object**) | 帳務明細：總額、稅金、其他費用...等                          | Ref. Response - Payment                               |

#### Response - Store

| Name                  | Type   | Description                                        |
| --------------------- | ------ | -------------------------------------------------- |
| id                    | string | 門店ID，範例：c7f1dc2f-fabe-4997-845c-cad26fdcb894 |
| name                  | string | 門店名稱，範例：Harry's Hamburgers                 |
| external_reference_id | string | 門店代碼，範例：HARRY_123                          |

#### Response - Eater

| Name       | Type   | Description                                        |
| ---------- | ------ | -------------------------------------------------- |
| first_name | string | 門店ID，範例：c7f1dc2f-fabe-4997-845c-cad26fdcb894 |
| last_name  | string | 客戶姓名                                           |

#### Response - Payment

| Name    | Type            | Description |
| ------- | --------------- | ----------- |
| charges | Charges(Object) | 帳務明細    |

#### Response - Cahrges

| Name          | Type          | Description                             | Database Column                                              |
| ------------- | ------------- | --------------------------------------- | ------------------------------------------------------------ |
| total         | Money(Object) | 總價                                    | dudoo_client.sales.amount 以及  dudoo_client.orders.sales_amount( sum(sub_total) ), dudoo_client.orders.amount |
| sub_total     | Money(Object) | 各個項目的單價                          | dudoo_client.sale_detials.price                              |
| tax           | Money(Object) | 稅金總額                                | x                                                            |
| total_fee     | Money(Object) | 費用總額（服務費、手續費...等）         | x                                                            |
| total_fee_tax | Money(Object) | 費用的稅金                              | x                                                            |
| bag_fee       | Money(Object) | 包裝費、提袋費，不包含在總價 total 之內 | x                                                            |

#### Response - Money

| Name             | Type    | Description      |
| ---------------- | ------- | ---------------- |
| amount           | integer | 金額數字         |
| currency_code    | string  | 各個項目的單價   |
| formatted_amount | string  | 格式化之後的金額 |

#### Response - Cart

| Name                 | Type   | Description                                      |
| -------------------- | ------ | ------------------------------------------------ |
| items                | Item[] | 所有置於購物車內的商品項目，Ref. Response - Item |
| special_instructions | string | 來自客戶的備註說明                               |

#### Response - Item

| Name                     | Type              | Description                                            | Database Column                                              |
| ------------------------ | ----------------- | ------------------------------------------------------ | ------------------------------------------------------------ |
| id                       | string            | 所有置於購物車內的商品項目                             | x                                                            |
| title                    | string            | dudoo_client.sale_detials.item_name                    |                                                              |
| external_data            | string            | 外部資料，自由輸入欄位                                 | dudoo_client.sale_detials.item_id                            |
| quantity                 | Integer           | 品項數量                                               | dudoo_client.sale_detials.num, dudoo_client.sales_detial.actural_num |
| price                    | ItemPrice(Object) | 品項價格資訊                                           | dudoo_client.sales_detial.price                              |
| selected_modifier_groups | ModifierGroup[]   | 標籤，例如：甜度、冰塊...                              | dudoo_client.sale_labels                                     |
| special_requests         | SpecialRequests[] | 客人的特別要求，針對某特定食材過敏的說明項             | x                                                            |
| default_quantity         | integer           | 預設品項數量                                           | x                                                            |
| special_instructions     | string            | 客人的特別要求，針對想客製化的項目說明，例如：微糖少冰 | x                                                            |

#### Response - ItemPrice

| Name             | Type          | Description                           | Database Column                                          |
| ---------------- | ------------- | ------------------------------------- | -------------------------------------------------------- |
| unit_price       | Monry(Object) | 單品價格，包含被選取的 optional items | dudoo_client.sale_labels.label_price                     |
| total_price      | Monry(Object) | 總價，包含被選取的 optional items     | dudoo_client.sale_detials.amount(商品的價錢＋標籤的價錢) |
| base_unit_price  | Monry(Object) | 單品價格，不包含任何 optional items   | 同上                                                     |
| base_total_price | Monry(Object) | 總價，不包含任何 optional items       | 同上                                                     |

#### Response - ModifierGroup

| Name           | Type   | Description                                                  | Database Column                                              |
| -------------- | ------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| id             | string |                                                              | x                                                            |
| title          | string | 標籤的名字                                                   | sale_labels.label_name                                       |
| external_data  | string | 對應group                                                    | 有selected_items，就塞sale_labels.label_group_id，沒有的話就塞到 sale_labels.label_id |
| selected_items | Item[] | 訂單裡，客人額外增加的項目，例如：少冰、微糖                 | 應該會放在訂單備註的欄位                                     |
| removed_items  | Item[] | 訂單裡移除掉的項目，例如：套餐裡預設有萵苣、番茄、培根。而客人取消勾選萵苣，被取消的項目就在這裡 | 應該會放在訂單備註的欄位                                     |

#### Response - Special Requests

| Name    | Type    | Description           |
| ------- | ------- | --------------------- |
| allergy | Allergy | As Response - Allergy |

#### Response - Allergy

| Name                 | Type     | Description            |
| -------------------- | -------- | ---------------------- |
| allergens_to_exclude | Allergen | As Response - Allergen |
| allergy_instructions | string   | 敘述客人過敏項目       |

#### Response - Allergen

| Name          | Type              | Description                                                  |
| ------------- | ----------------- | ------------------------------------------------------------ |
| type          | string (**enum**) | 過敏食材`DAIRY` `EGGS` `FISH` `SHELLFISH` `TREENUTS` `PEANUTS` `GLUTEN` `SOY` `OTHER` |
| freeform_text | string            | 客人自由輸入欄位，自述其他過敏食材                           |

#### Sample

```json
{
    "id": "5a6148bd-0859-49df-aee6-1a1dd4fa9748",
    "display_id": "A9748",
    "current_state": "ACCEPTED",
    "store": {
        "id": "7179aaee-c259-4f7c-b189-11e132adfcbe",
        "name": "Dudooeat Test Store 1"
    },
    "eater": {
        "first_name": "Dudooeat",
        "last_name": "D."
    },
    "cart": {
        "items": [
            {
                "id": "6612014",
                "title": "TWG鮮奶茶",
                "external_data": "7763",
                "quantity": 1,
                "price": {
                    "unit_price": {
                        "amount": 5500,
                        "currency_code": "TWD",
                        "formatted_amount": "NT$55.00"
                    },
                    "total_price": {
                        "amount": 5500,
                        "currency_code": "TWD",
                        "formatted_amount": "NT$55.00"
                    },
                    "base_unit_price": {
                        "amount": 5500,
                        "currency_code": "TWD",
                        "formatted_amount": "NT$55.00"
                    },
                    "base_total_price": {
                        "amount": 5500,
                        "currency_code": "TWD",
                        "formatted_amount": "NT$55.00"
                    }
                },
                "selected_modifier_groups": [
                    {
                        "id": "糖度-56094",
                        "title": "糖度",
                        "selected_items": [
                            {
                                "id": "正常糖",
                                "title": "正常糖",
                                "quantity": 1,
                                "price": {
                                    "unit_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "total_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "base_unit_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "base_total_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    }
                                },
                                "selected_modifier_groups": null,
                                "default_quantity": 0
                            }
                        ],
                        "removed_items": null
                    },
                    {
                        "id": "糖度",
                        "title": "冰度",
                        "external_data": "998sasasdasdsad",
                        "selected_items": [
                            {
                                "id": "少冰",
                                "title": "少冰ID",
                                "external_data": "abcdefghijklmnopqrstuvwxyz_0123456789\"{@_=.,/'}][%2226050456046045604/2a15s8zxcarjsokv你好lm;masd+do9",
                                "quantity": 1,
                                "price": {
                                    "unit_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "total_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "base_unit_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    },
                                    "base_total_price": {
                                        "amount": 0,
                                        "currency_code": "TWD",
                                        "formatted_amount": "NT$0.00"
                                    }
                                },
                                "selected_modifier_groups": null,
                                "default_quantity": 0
                            }
                        ],
                        "removed_items": null
                    }
                ]
            }
        ],
        "version_id": "85b65e0f-3c97-5e6c-be59-8ab36f9202d0"
    },
    "payment": {
        "charges": {
            "total": {
                "amount": 11500,
                "currency_code": "TWD",
                "formatted_amount": "NT$115.00"
            },
            "sub_total": {
                "amount": 5500,
                "currency_code": "TWD",
                "formatted_amount": "NT$55.00"
            },
            "total_fee": {
                "amount": 6000,
                "currency_code": "TWD",
                "formatted_amount": "NT$60.00"
            }
        }
    },
    "placed_at": "2020-04-09T08:04:31Z",
    "estimated_ready_for_pickup_at": "2020-04-09T08:19:31Z",
    "type": "DELIVERY_BY_UBER",
    "packaging": {
        "disposable_items": {
            "should_include": true
        }
    }
}
```

