# 结账

Checkout API 用于在店铺前台开启结账会话，并返回顾客要跳转到的结账地址。主题有两个场景会用到它：商品页的**立即购买**按钮，把单个商品直接带进结账、不经过购物车；订单页的**去支付**按钮，为顾客未付款的订单重新开启支付。

除 `GET` 以外的请求都要带 `X-CSRF-Token` 请求头，取值方式见[身份要求](/zh-CN/docs/theme/references/ajax-api/customer#%E8%BA%AB%E4%BB%BD%E8%A6%81%E6%B1%82)。本页的请求体都是 JSON，`Content-Type` 设为 `application/json`。

所有 Ajax API 请求应使用[多语言 URL](/zh-CN/docs/theme/references/ajax-api/#locale-aware-urls)，以便为访客提供一致的体验。

## 创建结账会话

```text
POST /{locale}/api/checkout/order
```

为一组 variant 创建结账会话。响应返回本页其他 endpoint 所需的 `order_token`，以及顾客要跳转到的 `checkout_url`。

### 请求示例

**请求示例**

```javascript
const data = {
  line_items: [
    {
      product_id: '14a309ec-b966-4cf9-a9bb-33baa821fdbc',
      variant_id: 'fff360dd-6457-466a-98b3-16878bacef5b',
      quantity: 1
    }
  ],
  refer_info: {
    source: 'buy_now'
  }
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRF-Token': getCsrfToken()
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### 请求参数

**数据结构 | 示例**

- `line_items` object[]

  要结账的 variant 列表。

  *   Array \[

  - `product_id` string

    variant 所属商品的 id。
  - `variant_id` string

    variant 的 id。
  - `quantity` number

    variant 的数量。
  *   \]
- `refer_info` object

  请求来源信息。包含 `source` 属性，取值为 `add_to_cart`、`buy_now` 或 `cart`。

  - `source` string

```json
{
  "line_items": [
    {
      "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
      "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
      "quantity": 1
    }
  ],
  "refer_info": {
    "source": "buy_now"
  }
}
```

### 响应

**数据结构 | 示例**

- `state` string

  请求结果标识，`success` 或 `0` 表示请求成功。
- `message` string

  响应返回的结果说明。
- `errors` undefined[]

  请求失败时返回的错误列表。
- `data` object

  响应数据主体。

  - `order_token` string

    标识该订单的 token。
  - `checkout_url` string

    订单结账页的相对地址。
  - `prices` object

    订单的金额明细。

    - `total_price` string

      应用折扣后购物车的总价。
    - `subtotal_price` string

      折扣前所有行项目价格的总和。
    - `shipping_price` string

      订单的运费。
    - `tax_price` string

      订单的税费。
    - `discount_price` string

      订单的折扣总额。
    - `discount_line_item_price` string

      已应用折扣的折后总价。
    - `discount_code_price` string

      优惠码带来的折扣金额。
    - `currency_code` string

      订单的货币代码，例如 `USD`。
  - `discount_applications` undefined[]

    该对象已应用的折扣。
  - `items` object[]

    购物车中的行项目列表。

    *   Array \[

    - `barcode` string

      款式的条形码。
    - `compare_at_price` string

      划线价。
    - `cost_price` string

      款式的成本价。
    - `custom` boolean

      该行项目是否为自定义商品。
    - `discount_applications` undefined[]

      该对象已应用的折扣。
    - `discount_total` string

      折扣总额。
    - `final_line_price` string

      应用行级折扣后，该行项目所有商品的合计价格。
    - `id` string

      行项目的 ID。
    - `image` object

      行项目所属款式的图片。

      - `alt` string

        图片的替代文本。
      - `height` number

        图片高度（像素）。
      - `path` string

        图片文件在图床上的路径。
      - `src` string

        图片的地址。
      - `width` number

        图片宽度（像素）。
    - `line_price` string

      应用折扣前，该行项目所有商品的合计价格。
    - `mixed_wholesale` boolean

      是否支持混批。
    - `note` string

      行项目的备注。
    - `options` object[]

      行项目所属款式的属性取值。

      *   Array \[

      - `name` string

        商品属性名称，例如 `Color`。
      - `value` string

        该商品属性被选中的取值。
      *   \]
    - `price` string

      行项目单件商品的价格。
    - `product_handle` string

      商品的 handle。
    - `product_id` string

      商品 ID。
    - `product_tags` undefined[]

      商品的标签。
    - `product_title` string

      商品名称。
    - `product_url` string

      商品页的相对地址。
    - `properties` string

      行项目上记录的自定义属性。
    - `quantity` number

      商品数量。
    - `requires_shipping` boolean

      是否需要物流配送。
    - `sku` string

      款式的 SKU，用于库存管理。
    - `spu` string

      商品的 SPU（标准产品单元）。
    - `tax_code` string
    - `tax_price` string

      行项目的税费。
    - `tax_rate` string

      适用的税率。
    - `taxable` boolean

      是否需要计税。
    - `trunk_price` string

      行项目的主干价格。
    - `variant_id` string

      款式 ID。
    - `variant_title` string

      款式标题，例如 `Blue, Size M`。
    - `vendor` string

      商品的供应商。
    - `vendor_url` string

      商品供应商的链接。
    - `weight` string

      款式的重量。
    - `weight_unit` string

      重量单位，例如 `kg`。
    - `wholesale_price` object[]

      批发价梯度列表。

      *   Array \[

      - `min_quantity` number

        该批发价梯度要求的最小数量。
      - `price` string

        该批发价梯度的单价。
      *   \]
    - `total` string

      行项目的总价。
    - `tax_lines` undefined[]

      订单的税费明细。
    - `final_price` string

      应用行级折扣后，该行项目单件商品的价格。
    - `is_free_gift` boolean

      该商品是否为赠品。
    - `excluded_tax_sub_total` string
    - `length` number

      该行项目包裹的长度。
    - `width` number

      该行项目包裹的宽度。
    - `height` number

      该行项目包裹的高度。
    - `dimension_unit` string

      包裹尺寸的单位。
    - `hs_code` string

      用于报关的 HS 编码。
    - `origin_country_code` string

      商品原产国的代码。
    - `origin_price` string
    - `duty_price` string

      行项目的关税费用。
    - `product_type` string

      商品类型。
    *   \]
  - `key` string

    与订单 ID 一起用于打开结账页的 key。
  - `line_items` object[]

    行项目列表。

    *   Array \[

    - `barcode` string

      款式的条形码。
    - `compare_at_price` string

      划线价。
    - `cost_price` string

      款式的成本价。
    - `custom` boolean

      该行项目是否为自定义商品。
    - `discount_applications` undefined[]

      该对象已应用的折扣。
    - `discount_total` string

      折扣总额。
    - `final_line_price` string

      应用行级折扣后，该行项目所有商品的合计价格。
    - `id` string

      行项目的 ID。
    - `image` object

      行项目所属款式的图片。

      - `alt` string

        图片的替代文本。
      - `height` number

        图片高度（像素）。
      - `path` string

        图片文件在图床上的路径。
      - `src` string

        图片的地址。
      - `width` number

        图片宽度（像素）。
    - `line_price` string

      应用折扣前，该行项目所有商品的合计价格。
    - `mixed_wholesale` boolean

      是否支持混批。
    - `note` string

      行项目的备注。
    - `options` object[]

      行项目所属款式的属性取值。

      *   Array \[

      - `name` string

        商品属性名称，例如 `Color`。
      - `value` string

        该商品属性被选中的取值。
      *   \]
    - `price` string

      行项目单件商品的价格。
    - `product_handle` string

      商品的 handle。
    - `product_id` string

      商品 ID。
    - `product_tags` undefined[]

      商品的标签。
    - `product_title` string

      商品名称。
    - `product_url` string

      商品页的相对地址。
    - `properties` string

      行项目上记录的自定义属性。
    - `quantity` number

      商品数量。
    - `requires_shipping` boolean

      是否需要物流配送。
    - `sku` string

      款式的 SKU，用于库存管理。
    - `spu` string

      商品的 SPU（标准产品单元）。
    - `tax_code` string
    - `tax_price` string

      行项目的税费。
    - `tax_rate` string

      适用的税率。
    - `taxable` boolean

      是否需要计税。
    - `trunk_price` string

      行项目的主干价格。
    - `variant_id` string

      款式 ID。
    - `variant_title` string

      款式标题，例如 `Blue, Size M`。
    - `vendor` string

      商品的供应商。
    - `vendor_url` string

      商品供应商的链接。
    - `weight` string

      款式的重量。
    - `weight_unit` string

      重量单位，例如 `kg`。
    - `wholesale_price` object[]

      批发价梯度列表。

      *   Array \[

      - `min_quantity` number

        该批发价梯度要求的最小数量。
      - `price` string

        该批发价梯度的单价。
      *   \]
    - `total` string

      行项目的总价。
    - `tax_lines` undefined[]

      订单的税费明细。
    - `final_price` string

      应用行级折扣后，该行项目单件商品的价格。
    - `is_free_gift` boolean

      该商品是否为赠品。
    - `excluded_tax_sub_total` string
    - `length` number

      该行项目包裹的长度。
    - `width` number

      该行项目包裹的宽度。
    - `height` number

      该行项目包裹的高度。
    - `dimension_unit` string

      包裹尺寸的单位。
    - `hs_code` string

      用于报关的 HS 编码。
    - `origin_country_code` string

      商品原产国的代码。
    - `origin_price` string
    - `duty_price` string

      行项目的关税费用。
    - `product_type` string

      商品类型。
    *   \]
  - `invalid_line_items` undefined[]

    未能计入订单的行项目。
  - `redirect_url` string

    顾客应被跳转到的地址。

```json
{
  "state": "success",
  "message": "success",
  "errors": [],
  "data": {
    "order_token": "2446407200000000000000",
    "checkout_url": "/checkout/2446407200000000000000",
    "prices": {
      "total_price": "1.00",
      "subtotal_price": "1.00",
      "shipping_price": "0.00",
      "tax_price": "0.00",
      "discount_price": "0.00",
      "discount_line_item_price": "0.00",
      "discount_code_price": "0.00",
      "currency_code": "USD"
    },
    "discount_applications": [],
    "items": [
      {
        "barcode": "",
        "compare_at_price": "1.00",
        "cost_price": "1.00",
        "custom": false,
        "discount_applications": [],
        "discount_total": "0.00",
        "final_line_price": "1.00",
        "id": "ec41e0a6-39ee-44ba-b832-d5e10c07a81d",
        "image": {
          "alt": "",
          "height": 1500,
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000
        },
        "line_price": "1.00",
        "mixed_wholesale": false,
        "note": "",
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "price": "1.00",
        "product_handle": "sample-product",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "product_tags": [],
        "product_title": "sample-product",
        "product_url": "/products/sample-product",
        "properties": "{}",
        "quantity": 1,
        "requires_shipping": true,
        "sku": "",
        "spu": "",
        "tax_code": "",
        "tax_price": "0.00",
        "tax_rate": "0.0000",
        "taxable": false,
        "trunk_price": "1.00",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "variant_title": "01",
        "vendor": "",
        "vendor_url": "",
        "weight": "0.00",
        "weight_unit": "kg",
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "total": "",
        "tax_lines": [],
        "final_price": "",
        "is_free_gift": false,
        "excluded_tax_sub_total": "",
        "length": 0,
        "width": 0,
        "height": 0,
        "dimension_unit": "",
        "hs_code": "",
        "origin_country_code": "",
        "origin_price": "",
        "duty_price": "",
        "product_type": "default"
      }
    ],
    "key": "155acc5b301bf2c259ebeeb6f6b6ba",
    "line_items": [
      {
        "barcode": "",
        "compare_at_price": "1.00",
        "cost_price": "1.00",
        "custom": false,
        "discount_applications": [],
        "discount_total": "0.00",
        "final_line_price": "1.00",
        "id": "ec41e0a6-39ee-44ba-b832-d5e10c07a81d",
        "image": {
          "alt": "",
          "height": 1500,
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000
        },
        "line_price": "1.00",
        "mixed_wholesale": false,
        "note": "",
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "price": "1.00",
        "product_handle": "sample-product",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "product_tags": [],
        "product_title": "sample-product",
        "product_url": "/products/sample-product",
        "properties": "{}",
        "quantity": 1,
        "requires_shipping": true,
        "sku": "",
        "spu": "",
        "tax_code": "",
        "tax_price": "0.00",
        "tax_rate": "0.0000",
        "taxable": false,
        "trunk_price": "1.00",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "variant_title": "01",
        "vendor": "",
        "vendor_url": "",
        "weight": "0.00",
        "weight_unit": "kg",
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "total": "",
        "tax_lines": [],
        "final_price": "",
        "is_free_gift": false,
        "excluded_tax_sub_total": "",
        "length": 0,
        "width": 0,
        "height": 0,
        "dimension_unit": "",
        "hs_code": "",
        "origin_country_code": "",
        "origin_price": "",
        "duty_price": "",
        "product_type": "default"
      }
    ],
    "invalid_line_items": [],
    "redirect_url": ""
  }
}
```

## 获取结账会话

```text
GET /{locale}/api/checkout/order/{order_id}
```

获取结账会话的当前状态，`order_id` 取结账地址里的 order token。

### 请求示例

**请求示例**

```javascript
fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/2446407200000000000000')
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### 请求参数

- `order_id` string

  创建结账会话时返回的 order token。

### 响应

**数据结构 | 示例**

- `data` object

  响应数据主体。

  - `id` string

    订单的 ID。
  - `refer_info` object

    顾客访问来源信息。

    - `address_check` boolean
    - `client_id` string
    - `country` string
    - `customer_session` string
    - `domain` string
    - `fbc` string
    - `fbp` string
    - `inventory_deduction` string
    - `ip` string

      访客的 IP 地址。
    - `seg` string
    - `session_id` string
    - `source` string
    - `user_agent` string
  - `order_no` string

    订单号。
  - `create_time` string

    订单创建时间，与 `create_at` 相同。
  - `placed_at` string

    订单支付时间。
  - `status` string

    订单状态，例如 `opened`、`placed`、`finished`。
  - `financial_status` string

    订单的支付状态，例如 `waiting`、`paid`。
  - `fulfillment_status` string

    发货状态，例如 `waiting`、`shipped`、`finished`。
  - `post_sale_status` string

    订单的售后状态。
  - `email_status` string

    订单召回邮件的状态，`waiting` 待发送，`send` 已发送。
  - `note` string

    商家为订单添加的备注。
  - `cancel_reason` string

    订单的取消原因。
  - `discount_code` string

    订单使用的优惠码。
  - `customer_note` string

    顾客在结账时填写的备注。
  - `currency_code` string

    订单的货币代码，例如 `USD`。
  - `shipping_address_editable` boolean

    收货地址是否仍可修改。
  - `config` object

    订单的配置信息。

    - `page_type` string

      结账页的版式，例如 `three_step`。
    - `requires_shipping` boolean

      是否需要物流配送。
    - `checkout_business_type` number
    - `product_tax_included` boolean

      商品价格是否含税。
    - `checkout_template_type` number
    - `market_setting` object

      订单适用的市场设置。

      - `primary_market_lang` string

        店铺主市场的语言代码。
      - `market_lang` string

        市场使用的语言代码。
      - `market_id` string

        订单所属市场的 ID。
      - `market_currency` string

        市场使用的货币代码。
      - `market_currency_symbol` object

        市场货币的符号信息。

        - `code` string

          货币代码，例如 `USD`。
        - `val` string

          货币符号，例如 `$`。
        - `left` string

          显示在金额左侧的内容。
        - `right` string

          显示在金额右侧的内容。
      - `market_base_currency` string

        市场的基准货币代码。
      - `market_base_currency_symbol` object

        市场基准货币的符号信息。

        - `code` string

          货币代码，例如 `USD`。
        - `val` string

          货币符号，例如 `$`。
        - `left` string

          显示在金额左侧的内容。
        - `right` string

          显示在金额右侧的内容。
      - `primary_market_id` string

        店铺主市场的 ID。
      - `primary_market_currency` string

        店铺主市场的货币代码。
      - `primary_market_currency_symbol` object

        店铺主市场货币的符号信息。

        - `code` string

          货币代码，例如 `USD`。
        - `val` string

          货币符号，例如 `$`。
        - `left` string

          显示在金额左侧的内容。
        - `right` string

          显示在金额右侧的内容。
      - `market_price_setting` object

        - `local_currency_enabled` boolean
        - `custom_rate_enabled` boolean
        - `custom_rate` number
        - `rate` number
        - `back_rate` number
        - `actual_rate` number
        - `base_to_local` number
        - `local_to_base` number
        - `adjust` number
        - `price_round_enabled` boolean
      - `market_country` string

        市场所属国家的代码。
  - `discount_applications` undefined[]

    该对象已应用的折扣。
  - `canceled_at` string

    订单取消时间。
  - `fail_code` string
  - `shipping_line` undefined[]

    订单所选的物流方案。
  - `customer` object

    顾客详情。

    - `id` string

      顾客的 ID。
    - `email` string

      顾客的邮箱地址。
    - `first_name` string

      顾客或收件人的名。
    - `last_name` string

      顾客或收件人的姓。
    - `phone` string

      顾客的电话号码。
    - `tags` undefined[]

      对象上的标签。
    - `subscribed` boolean

      顾客是否订阅了营销信息。
    - `name` string

      顾客的全名。
    - `note` string

      对象上的备注。
    - `contact` string

      顾客的联系方式，邮箱或电话号码。
    - `contact_type` string

      联系方式类型，邮箱或电话。
    - `created_at` string

      创建时间（ISO-8601 格式）。
    - `registered` boolean

      顾客是否已注册账号。
    - `registered_at` string

      顾客完成注册的时间。
    - `source` string

      顾客数据的来源。
    - `free_tax` string

      顾客是否享有税收豁免。
    - `location_id` string
    - `customer_extra_info` object

      顾客的附加统计信息。

      - `finished_order_count` number

        顾客已完成的订单数。
      - `finished_order_total` string

        顾客已完成订单的总金额。
      - `country` string
      - `country_code` string
      - `province` string

        地址所在省或州。
      - `province_code` string

        省或州的代码。
      - `currency_code` string

        订单的货币代码，例如 `USD`。
      - `purchase_product_count` number

        顾客已购买的商品件数。
      - `store_customer_id` string
      - `customer_role` string
      - `ext` string
      - `first_order_at` string

        顾客首次下单时间。
      - `last_order_at` string

        顾客最后一次下单时间。
  - `shipping_address` object

    订单的收货地址。

    - `id` string

      地址的 ID。
    - `first_name` string

      顾客或收件人的名。
    - `last_name` string

      顾客或收件人的姓。
    - `email` string

      与该地址关联的邮箱。
    - `phone` string

      与该地址关联的电话号码。
    - `country_code` string

      地址所在国家的 ISO 代码。
    - `country` string

      地址所在国家的名称。
    - `province_code` string

      省或州的代码。
    - `province` string

      地址所在省或州。
    - `area` string

      地址所在区域。
    - `city` string

      地址所在城市。
    - `address` string

      收件人的详细地址。
    - `address1` string

      详细地址第一行。
    - `zip` string

      邮政编码。
    - `extra_info` string
    - `company` string

      地址的公司名称。
    - `phone_area_code` string

      电话号码的区号。
    - `latitude` string

      地址的纬度。
    - `longitude` string

      地址的经度。
    - `source` string
    - `tags` string

      对象上的标签。
  - `billing_address` string

    订单的账单地址。
  - `line_items` object[]

    行项目列表。

    *   Array \[

    - `id` string

      行项目的 ID。
    - `product_title` string

      商品名称。
    - `product_id` string

      商品 ID。
    - `product_handle` string

      商品的 handle。
    - `variant_id` string

      款式 ID。
    - `variant_title` string

      款式标题，例如 `Blue, Size M`。
    - `quantity` number

      商品数量。
    - `fulfillment_status` string

      发货状态，例如 `waiting`、`shipped`、`finished`。
    - `note` string

      行项目的备注。
    - `image` object

      行项目所属款式的图片。

      - `alt` string

        图片的替代文本。
      - `height` number

        图片高度（像素）。
      - `path` string

        图片文件在图床上的路径。
      - `src` string

        图片的地址。
      - `width` number

        图片宽度（像素）。
    - `compare_at_price` string

      划线价。
    - `price` string

      行项目单件商品的价格。
    - `total` string

      行项目的总价。
    - `sku` string

      款式的 SKU，用于库存管理。
    - `weight` string

      款式的重量。
    - `weight_unit` string

      重量单位，例如 `kg`。
    - `taxable` boolean

      是否需要计税。
    - `requires_shipping` boolean

      是否需要物流配送。
    - `options` object[]

      行项目所属款式的属性取值。

      *   Array \[

      - `name` string

        商品属性名称，例如 `Color`。
      - `value` string

        该商品属性被选中的取值。
      *   \]
    - `vendor` string

      商品的供应商。
    - `product_url` string

      商品页的相对地址。
    - `properties` string

      行项目上记录的自定义属性。
    - `barcode` string

      款式的条形码。
    - `product_spu` string

      商品的 SPU。
    - `product_vendor_url` string

      商品供应商的链接。
    - `product_tags` undefined[]

      商品的标签。
    - `discount_applications` undefined[]

      该对象已应用的折扣。
    - `tax_code` string
    - `tax_rate` string

      适用的税率。
    - `tax_price` string

      行项目的税费。
    - `wholesale_price` object[]

      批发价梯度列表。

      *   Array \[

      - `price` string

        该批发价梯度的单价。
      - `min_quantity` number

        该批发价梯度要求的最小数量。
      *   \]
    - `mixed_wholesale` boolean

      是否支持混批。
    - `item_price` string
    - `cost_price` string

      款式的成本价。
    - `custom` boolean

      该行项目是否为自定义商品。
    - `trunk_price` string

      行项目的主干价格。
    - `main_currency_prices` object

      订单金额换算成店铺主货币后的结果。

      - `compare_at_price` string

        划线价。
      - `price` string

        换算成店铺主货币后的单价。
      - `total` string

        换算成店铺主货币后的总额。
      - `tax_price` string

        行项目的税费。
      - `item_price` string
      - `cost_price` string

        款式的成本价。
      - `trunk_price` string

        行项目的主干价格。
      - `actual_rate` string

        换算所用的汇率。
    - `fixed_discount_total` string
    - `excluded_tax_sub_total` string
    - `tax_lines` undefined[]

      订单的税费明细。
    - `length` number

      该行项目包裹的长度。
    - `width` number

      该行项目包裹的宽度。
    - `height` number

      该行项目包裹的高度。
    - `dimension_unit` string

      包裹尺寸的单位。
    - `commission` string
    - `origin_country_code` string

      商品原产国的代码。
    - `hs_code` string

      用于报关的 HS 编码。
    - `created_by` string
    - `origin_price` string
    - `duty_price` string

      行项目的关税费用。
    - `line_price` string

      应用折扣前，该行项目所有商品的合计价格。
    - `discount_total` string

      折扣总额。
    - `final_line_price` string

      应用行级折扣后，该行项目所有商品的合计价格。
    - `final_price` string

      应用行级折扣后，该行项目单件商品的价格。
    *   \]
  - `payment_line` string

    订单的支付详情。
  - `test` boolean

    是否为测试订单。
  - `order_status_url` string

    订单状态页的相对地址。
  - `order_key` string

    与订单 ID 一起用于访问订单的 key。
  - `yet_payment` string

    订单尚未支付的金额。
  - `refund` string

    订单的退款金额。
  - `installment_fee` string

    订单的分期手续费。
  - `paid_total` string

    订单已支付的总金额。
  - `updated_time` string

    订单最后更新时间。
  - `checkout_id` string
  - `tax_type` number
  - `applied_gift_cards` undefined[]

    订单已使用的礼品卡。
  - `payment_lines` undefined[]

    订单的支付记录列表。
  - `checkout_url` string

    订单结账页的相对地址。
  - `finished_at` string

    订单完成时间。
  - `fulfillments` undefined[]

    订单的物流记录列表。
  - `identifier_extra` string
  - `main_currency_prices` object

    订单金额换算成店铺主货币后的结果。

    - `sub_total` string

      应用订单级折扣前，所有行项目价格的总和。
    - `shipping_total` string

      订单的运费总额。
    - `tax_total` string

      订单的税费总额。
    - `discount_total` string

      折扣总额。
    - `total` string

      换算成店铺主货币后的总额。
    - `total_tip_received` string

      订单收到的小费总额。
    - `refund_total` string

      订单的退款总额。
    - `actual_rate` string

      换算所用的汇率。
  - `shipping_line_detail` string
  - `order_type` number

    订单类型，`0` 为普通订单，`1` 为礼品卡订单。
  - `shipping_tax_type` number
  - `product_tax_included` boolean

    商品价格是否含税。
  - `translations` undefined[]
  - `location_line` object

    商家仓库地址。

    - `id` string

      地址的 ID。
    - `location_id` string

      仓库 ID。
    - `location_name` string

      仓库名称。
    - `first_name` string

      顾客或收件人的名。
    - `last_name` string

      顾客或收件人的姓。
    - `phone` string

      与该地址关联的电话号码。
    - `email` string

      与该地址关联的邮箱。
    - `country` string

      地址所在国家的名称。
    - `country_code` string

      地址所在国家的 ISO 代码。
    - `province` string

      地址所在省或州。
    - `province_code` string

      省或州的代码。
    - `area` string

      地址所在区域。
    - `city` string

      地址所在城市。
    - `address` string

      收件人的详细地址。
    - `address1` string

      详细地址第一行。
    - `company` string

      地址的公司名称。
    - `latitude` string

      地址的纬度。
    - `longitude` string

      地址的经度。
    - `zip` string

      邮政编码。
    - `phone_area_code` string

      电话号码的区号。
    - `extra_info` string
  - `additional_total` string

    订单的附加费用总额。
  - `additional_prices` undefined[]

    附加费用明细。
  - `tax_lines` object

    订单的税费明细。

    - `sales_tax_lines` undefined[]
  - `locale_zone` string
  - `tags` undefined[]

    对象上的标签。
  - `order_customer` object

    订单上记录的顾客信息。

    - `origin_id` string
    - `first_name` string

      顾客或收件人的名。
    - `last_name` string

      顾客或收件人的姓。
    - `email` string

      顾客的邮箱地址。
    - `phone` string

      顾客的电话号码。
    - `customer_role` string
    - `ext` undefined[]
  - `duty_total` string

    订单的关税税费总额。
  - `mail_send_config` undefined[]
  - `custom_fields` undefined[]
  - `already_payment_lines` undefined[]
  - `additional_rules` object[]

    *   Array \[

    - `id` string
    - `name` string
    - `input_type` number
    - `description` string
    - `enable` number
    - `show_type` string
    - `show_rules` object[]

      *   Array \[

      - `field` string
      - `rules` undefined[]
      *   \]
    - `require` number
    - `validates` undefined[]
    - `enums` undefined[]
    *   \]
  - `checkout_settings` object

    店铺的结账设置。

    - `customer_authority` string
    - `checkout_page_type` string

      结账页的版式，例如 `three_step`。
    - `lineitems_validate` boolean
    - `discount_show` string
    - `discount_show_v2` string[]
    - `reduction_show` object

      - `single` string[]
      - `two_step` string[]
      - `three_step` string[]
    - `zip_check` string
    - `zip_check_v2` string
    - `zip_format_check` string
    - `zip_check_config` object

      - `GB` number
      - `US` number
      - `BR` number
      - `MX` number
      - `CL` number
      - `CO` number
      - `DE` number
      - `KR` number
      - `RO` number
    - `zip_check_config_v2` object

      - `AE` number
      - `BH` number
      - `KW` number
      - `OM` number
      - `QA` number
      - `SA` number
    - `order_timeout` number
    - `inventory_deduction` string
    - `shipping_cpf` object

      - `config_info` object

        - `config_default` object

          - `length` string
          - `type` string
        - `config_br` object

          - `length` string
          - `type` string
      - `is_show_countries` object

        - `cpf_cnpj` object

          - `title` string
          - `country_codes` string
          - `is_filled` boolean
          - `countries` string
          - `format_check` boolean
        - `rut` object

          - `title` string
          - `country_codes` string
          - `is_filled` boolean
          - `countries` string
          - `format_check` boolean
        - `other` object

          - `title` string
          - `is_filled` boolean
          - `countries` undefined[]
          - `format_check` boolean
      - `countries` undefined[]
      - `is_show` boolean
    - `instruction` string
    - `address_setting` object

      - `name` string

        地址表单中姓名字段的排布方式。
      - `email` string

        地址表单中邮箱字段的展示设置。
      - `phone` string

        地址表单中电话字段的展示设置。
      - `company` string

        地址表单中公司字段的展示设置，例如 `hidden`。
      - `address` string

        地址表单中详细地址字段的展示设置。
      - `address1` string

        地址表单中详细地址字段的展示设置。
      - `name_requirement` string

        姓名字段中哪一项必填，例如 `last_name`。
      - `contact_details` string

        地址表单收集联系方式的方式。
    - `auto_complete` string
    - `doorplate_format_check` string
    - `forced_zip_check` string[]
    - `identification_info` object

      - `default` object

        - `countries` string
        - `format_check` boolean
        - `is_filled` boolean
        - `rules` object[]

          *   Array \[

          - `country_code` string
          - `name` string
          - `regexp` string
          - `example_val` string
          *   \]
    - `shipping_method_display_style` string
  - `address_settings` object

    地址表单的配置。

    - `name` string

      地址表单中姓名字段的排布方式。
    - `email` string

      地址表单中邮箱字段的展示设置。
    - `phone` string

      地址表单中电话字段的展示设置。
    - `company` string

      地址表单中公司字段的展示设置，例如 `hidden`。
    - `address` string

      地址表单中详细地址字段的展示设置。
    - `address1` string

      地址表单中详细地址字段的展示设置。
    - `name_requirement` string

      姓名字段中哪一项必填，例如 `last_name`。
    - `contact_details` string

      地址表单收集联系方式的方式。
  - `customer_info` object

    结账时填写的联系信息。

    - `email` string

      顾客的邮箱地址。
    - `first_name` string

      顾客或收件人的名。
    - `last_name` string

      顾客或收件人的姓。
    - `phone` string

      顾客的电话号码。
  - `payment_settings` object

    结账页可用的支付设置。

    - `settings` object

      - `dynamic_config` object

        - `paypal_js_sdk_url` string
        - `express_checkout_config` object

          - `express_channels` undefined[]
          - `express_account_infos` undefined[]
          - `express_theme_configs` undefined[]
        - `scm` string
        - `unified_user_id` string
        - `fallback_reason` string
        - `request_id` string
        - `ec_legacy_apple_pay_block_store_ids` string[]
        - `ec_legacy_google_pay_block_store_ids` string[]
        - `ec_legacy_spz_paypal_store_ids` undefined[]
      - `express_checkout_config` object

        - `express_account_infos` undefined[]
        - `express_channels` undefined[]
        - `express_theme_configs` undefined[]
      - `payment_icon_resources` undefined[]
      - `payment_resources` undefined[]
      - `paypal_account` undefined[]
      - `paypal_account_type` string
      - `paypal_creditcard_enabled` boolean
      - `paypal_express_enabled` boolean
      - `paypal_shipment_enabled` boolean
      - `support_channels` string[]
  - `order_token` string

    标识该订单的 token。
  - `currency_symbol` string

    订单的货币符号。
  - `currency_symbol_pos` string

    货币符号的位置，`left` 或 `right`。
  - `payment_due` string

    订单尚未支付的金额。
  - `all_tax_total` string

    订单所有税费的合计。
  - `prices` object

    订单的金额明细。

    - `subtotal_price` string

      折扣前所有行项目价格的总和。
    - `shipping_price` string

      订单的运费。
    - `tax_price` string

      订单的税费。
    - `discount_code_price` string

      优惠码带来的折扣金额。
    - `discount_price` string

      订单的折扣总额。
    - `total_price` string

      应用折扣后购物车的总价。
    - `shipping_tax_total` string

      订单的运费税总额。
    - `discount_line_item_price` string

      已应用折扣的折后总价。
    - `total_tip_received` string

      订单收到的小费总额。
    - `discount_shipping_price` string

      运费上的折扣金额。
    - `discount_sub_total` string

      折扣后的小计金额。
    - `gift_card_price` string

      礼品卡抵扣的金额。
    - `paid_total` string

      订单已支付的总金额。
    - `payment_due` string

      订单尚未支付的金额。
    - `all_tax_total` string

      订单所有税费的合计。
    - `payment_discount_total` string

      支付方式带来的折扣金额。
    - `additional_total` string

      订单的附加费用总额。
    - `duty_total` string

      订单的关税税费总额。
  - `except_notification` object

    完成订单时出现的异常信息。

    - `code` string

      异常代码，例如 `total_price_changed`。
  - `ip_address` object

    根据顾客 IP 解析出的位置信息。

    - `country_code` string

      根据顾客 IP 解析出的国家代码。
    - `province_name` string

      根据顾客 IP 解析出的省份名称。
    - `country_name` string

      根据顾客 IP 解析出的国家名称。
    - `city` string

      地址所在城市。
    - `ip` string

      访客的 IP 地址。
  - `policy_titles` undefined[]

    结账页展示的店铺条款标题。
  - `checkout_page_type` string

    结账页的版式，例如 `three_step`。
  - `step` string

    结账流程当前所处的步骤。
- `state` string

  请求结果标识，`success` 或 `0` 表示请求成功。
- `message` string

  响应返回的结果说明。
- `errors` undefined[]

  请求失败时返回的错误列表。

```json
{
  "data": {
    "id": "2446407200000000000000",
    "refer_info": {
      "address_check": false,
      "client_id": "1788247080462259",
      "country": "US",
      "customer_session": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
      "domain": "your-store.myshoplaza.com",
      "fbc": "",
      "fbp": "",
      "inventory_deduction": "order_created",
      "ip": "203.0.113.10",
      "seg": "A",
      "session_id": "1788402790610476",
      "source": "buy_now",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36"
    },
    "order_no": "ZYJ33469",
    "create_time": "2026-09-03T02:37:43Z",
    "placed_at": null,
    "status": "opened",
    "financial_status": "waiting",
    "fulfillment_status": "initialled",
    "post_sale_status": null,
    "email_status": "send",
    "note": null,
    "cancel_reason": null,
    "discount_code": "",
    "customer_note": "",
    "currency_code": "USD",
    "shipping_address_editable": true,
    "config": {
      "page_type": "three_step",
      "requires_shipping": true,
      "checkout_business_type": 0,
      "product_tax_included": false,
      "checkout_template_type": 0,
      "market_setting": {
        "primary_market_lang": "en-US",
        "market_lang": "en-US",
        "market_id": "653506617437848647",
        "market_currency": "USD",
        "market_currency_symbol": {
          "code": "USD",
          "val": "$",
          "left": "$",
          "right": ""
        },
        "market_base_currency": "USD",
        "market_base_currency_symbol": {
          "code": "USD",
          "val": "$",
          "left": "$",
          "right": ""
        },
        "primary_market_id": "653506617437848647",
        "primary_market_currency": "USD",
        "primary_market_currency_symbol": {
          "code": "USD",
          "val": "$",
          "left": "$",
          "right": ""
        },
        "market_price_setting": {
          "local_currency_enabled": false,
          "custom_rate_enabled": false,
          "custom_rate": 0,
          "rate": 1,
          "back_rate": 1,
          "actual_rate": 1,
          "base_to_local": 0,
          "local_to_base": 0,
          "adjust": 0,
          "price_round_enabled": true
        },
        "market_country": "US"
      }
    },
    "discount_applications": [],
    "canceled_at": null,
    "fail_code": null,
    "shipping_line": [],
    "customer": {
      "id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5",
      "email": "jane@example.com",
      "first_name": "Jane",
      "last_name": "Doe",
      "phone": "+1 555-0100",
      "tags": [],
      "subscribed": true,
      "name": "Jane Doe",
      "note": null,
      "contact": "jane@example.com",
      "contact_type": "email",
      "created_at": "2026-09-02T14:13:31Z",
      "registered": true,
      "registered_at": "2026-09-03T01:03:32Z",
      "source": "order_create_c",
      "free_tax": null,
      "location_id": "",
      "customer_extra_info": {
        "finished_order_count": 2,
        "finished_order_total": "33.0",
        "country": "United States",
        "country_code": "US",
        "province": "California",
        "province_code": "US-CA",
        "currency_code": "USD",
        "purchase_product_count": 4,
        "store_customer_id": "",
        "customer_role": null,
        "ext": null,
        "first_order_at": "2026-09-03T02:19:44Z",
        "last_order_at": "2026-09-03T02:32:31Z"
      }
    },
    "shipping_address": {
      "id": "",
      "first_name": "Jane",
      "last_name": "Doe",
      "email": "jane@example.com",
      "phone": null,
      "country_code": "US",
      "country": "United States",
      "province_code": "US-CA",
      "province": "California",
      "area": null,
      "city": "Los Angeles",
      "address": "123 Main St",
      "address1": null,
      "zip": "90001",
      "extra_info": null,
      "company": null,
      "phone_area_code": "00",
      "latitude": null,
      "longitude": null,
      "source": null,
      "tags": null
    },
    "billing_address": null,
    "line_items": [
      {
        "id": "ec41e0a6-39ee-44ba-b832-d5e10c07a81d",
        "product_title": "sample-product",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "product_handle": "sample-product",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "variant_title": "01",
        "quantity": 1,
        "fulfillment_status": "waiting",
        "note": "",
        "image": {
          "alt": "",
          "height": 1500,
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000
        },
        "compare_at_price": "1.00",
        "price": "1.00",
        "total": "1.00",
        "sku": "",
        "weight": "0.00",
        "weight_unit": "kg",
        "taxable": false,
        "requires_shipping": true,
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "vendor": "",
        "product_url": "/products/sample-product",
        "properties": "{}",
        "barcode": "",
        "product_spu": "",
        "product_vendor_url": "",
        "product_tags": [],
        "discount_applications": [],
        "tax_code": "",
        "tax_rate": "0.0000",
        "tax_price": "0.00",
        "wholesale_price": [
          {
            "price": "1.00",
            "min_quantity": 1
          }
        ],
        "mixed_wholesale": false,
        "item_price": "0.00",
        "cost_price": "1.00",
        "custom": false,
        "trunk_price": "1.00",
        "main_currency_prices": {
          "compare_at_price": "1",
          "price": "1",
          "total": "1",
          "tax_price": "0",
          "item_price": "",
          "cost_price": "1",
          "trunk_price": "1",
          "actual_rate": "1"
        },
        "fixed_discount_total": "0.00",
        "excluded_tax_sub_total": "1.00",
        "tax_lines": [],
        "length": 0,
        "width": 0,
        "height": 0,
        "dimension_unit": "",
        "commission": "",
        "origin_country_code": "",
        "hs_code": "",
        "created_by": "admin",
        "origin_price": "1.00",
        "duty_price": "0.00",
        "line_price": "1.00",
        "discount_total": "0.00",
        "final_line_price": "1.00",
        "final_price": "1.00"
      }
    ],
    "payment_line": null,
    "test": false,
    "order_status_url": "/order/2446407200000000000000/authenticate?key=155acc5b301bf2c259ebeeb6f6b6ba",
    "order_key": "155acc5b301bf2c259ebeeb6f6b6ba",
    "yet_payment": "0.00",
    "refund": "0.00",
    "installment_fee": "0.00",
    "paid_total": "0.00",
    "updated_time": "2026-09-03T02:38:16Z",
    "checkout_id": "0",
    "tax_type": 0,
    "applied_gift_cards": [],
    "payment_lines": [],
    "checkout_url": "/checkout/2446407200000000000000?key=155acc5b301bf2c259ebeeb6f6b6ba",
    "finished_at": null,
    "fulfillments": [],
    "identifier_extra": "",
    "main_currency_prices": {
      "sub_total": "1",
      "shipping_total": "0",
      "tax_total": "0",
      "discount_total": "0",
      "total": "1",
      "total_tip_received": "0",
      "refund_total": "0",
      "actual_rate": "1"
    },
    "shipping_line_detail": null,
    "order_type": 0,
    "shipping_tax_type": 0,
    "product_tax_included": false,
    "translations": [],
    "location_line": {
      "id": "282823366795125518",
      "location_id": "653509177250953159",
      "location_name": "Default",
      "first_name": "Jane",
      "last_name": "Doe",
      "phone": "+1 555-0100",
      "email": "jane@example.com",
      "country": "",
      "country_code": "",
      "province": "",
      "province_code": "",
      "area": "",
      "city": "",
      "address": "123 Main St",
      "address1": "123 Main St",
      "company": "",
      "latitude": "0.000000",
      "longitude": "0.000000",
      "zip": "",
      "phone_area_code": "",
      "extra_info": "{}"
    },
    "additional_total": "0.00",
    "additional_prices": [],
    "tax_lines": {
      "sales_tax_lines": []
    },
    "locale_zone": "+0800",
    "tags": [],
    "order_customer": {
      "origin_id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5",
      "first_name": "Jane",
      "last_name": "Doe",
      "email": "jane@example.com",
      "phone": "+1 555-0100",
      "customer_role": "",
      "ext": []
    },
    "duty_total": "0.00",
    "mail_send_config": [],
    "custom_fields": [],
    "already_payment_lines": [],
    "additional_rules": [
      {
        "id": "2446407_key_1",
        "name": "Backup phone",
        "input_type": 3,
        "description": "",
        "enable": 0,
        "show_type": "all",
        "show_rules": [
          {
            "field": "country_code",
            "rules": []
          }
        ],
        "require": 0,
        "validates": [],
        "enums": []
      }
    ],
    "checkout_settings": {
      "customer_authority": "all",
      "checkout_page_type": "three_step",
      "lineitems_validate": false,
      "discount_show": "default_new",
      "discount_show_v2": [
        "contact_information",
        "shipping_method",
        "payment_method"
      ],
      "reduction_show": {
        "single": [
          "contact_information"
        ],
        "two_step": [
          "payment_method",
          "contact_information"
        ],
        "three_step": [
          "contact_information",
          "shipping_method",
          "payment_method"
        ]
      },
      "zip_check": "disabled",
      "zip_check_v2": "multiple",
      "zip_format_check": "enabled",
      "zip_check_config": {
        "GB": 1,
        "US": 0,
        "BR": 0,
        "MX": 0,
        "CL": 0,
        "CO": 0,
        "DE": 0,
        "KR": 1,
        "RO": 1
      },
      "zip_check_config_v2": {
        "AE": 2,
        "BH": 2,
        "KW": 2,
        "OM": 2,
        "QA": 2,
        "SA": 2
      },
      "order_timeout": 0,
      "inventory_deduction": "order_created",
      "shipping_cpf": {
        "config_info": {
          "config_default": {
            "length": "30",
            "type": "string"
          },
          "config_br": {
            "length": "11",
            "type": "number"
          }
        },
        "is_show_countries": {
          "cpf_cnpj": {
            "title": "CPF/CNPJ",
            "country_codes": "BR",
            "is_filled": false,
            "countries": null,
            "format_check": false
          },
          "rut": {
            "title": "RUT",
            "country_codes": "CL",
            "is_filled": false,
            "countries": null,
            "format_check": false
          },
          "other": {
            "title": "Tax ID",
            "is_filled": false,
            "countries": [],
            "format_check": false
          }
        },
        "countries": [],
        "is_show": false
      },
      "instruction": "unfold",
      "address_setting": {
        "name": "separate",
        "email": "jane@example.com",
        "phone": "+1 555-0100",
        "company": "hidden",
        "address": "123 Main St",
        "address1": "123 Main St",
        "name_requirement": "last_name",
        "contact_details": "multiple"
      },
      "auto_complete": "enabled",
      "doorplate_format_check": "disabled",
      "forced_zip_check": [
        "GB",
        "MX"
      ],
      "identification_info": {
        "default": {
          "countries": null,
          "format_check": false,
          "is_filled": false,
          "rules": [
            {
              "country_code": "ALL",
              "name": "ID numbers",
              "regexp": "/^.{1,49}$/",
              "example_val": "00000001"
            },
            {
              "country_code": "TR",
              "name": "T.C. Kimlik Numarası",
              "regexp": "/^\\d{11}$/",
              "example_val": "12345678901"
            },
            {
              "country_code": "MO",
              "name": "Macao Resident Identity Card",
              "regexp": "/^[1|5|7]\\d{6}\\(\\d\\)$/",
              "example_val": "1234567(8)"
            }
          ]
        }
      },
      "shipping_method_display_style": "manual_select"
    },
    "address_settings": {
      "name": "separate",
      "email": "jane@example.com",
      "phone": "+1 555-0100",
      "company": "hidden",
      "address": "123 Main St",
      "address1": "123 Main St",
      "name_requirement": "last_name",
      "contact_details": "multiple"
    },
    "customer_info": {
      "email": "jane@example.com",
      "first_name": "Jane",
      "last_name": "Doe",
      "phone": "+1 555-0100"
    },
    "payment_settings": {
      "settings": {
        "dynamic_config": {
          "paypal_js_sdk_url": "https://www.paypal.com/sdk/js?client-id=AUwoRlv3iZ3jt3o3hhcft_tZ5g6tvefEpjCf9YNGeH7q8p_WraleitkKfLnWIs8HLpzalgRA5AMT0BYO&currency=USD&disable-funding=card%2Cbancontact%2Cblik%2Ceps%2Cgiropay%2Cideal%2Cmercadopago%2Cmybank%2Cp24%2Csepa%2Csofort%2Cvenmo&enable-funding=paylater",
          "express_checkout_config": {
            "express_channels": [],
            "express_account_infos": [],
            "express_theme_configs": []
          },
          "scm": "",
          "unified_user_id": "",
          "fallback_reason": "",
          "request_id": "279854cd-e65e-4275-a526-a262bb4c9c49",
          "ec_legacy_apple_pay_block_store_ids": [
            "2036132",
            "2171855",
            "2374192"
          ],
          "ec_legacy_google_pay_block_store_ids": [
            "2036132",
            "2171855",
            "2374192"
          ],
          "ec_legacy_spz_paypal_store_ids": []
        },
        "express_checkout_config": {
          "express_account_infos": [],
          "express_channels": [],
          "express_theme_configs": []
        },
        "payment_icon_resources": [],
        "payment_resources": [],
        "paypal_account": [],
        "paypal_account_type": "merchant",
        "paypal_creditcard_enabled": true,
        "paypal_express_enabled": false,
        "paypal_shipment_enabled": true,
        "support_channels": [
          "bogus"
        ]
      }
    },
    "order_token": "2446407200000000000000",
    "currency_symbol": "$",
    "currency_symbol_pos": "left",
    "payment_due": "1.00",
    "all_tax_total": "0.00",
    "prices": {
      "subtotal_price": "1.00",
      "shipping_price": "0.00",
      "tax_price": "0.00",
      "discount_code_price": "0.00",
      "discount_price": "0.00",
      "total_price": "1.00",
      "shipping_tax_total": "0.00",
      "discount_line_item_price": "0.00",
      "total_tip_received": "0.00",
      "discount_shipping_price": "0.00",
      "discount_sub_total": "1.00",
      "gift_card_price": "0.00",
      "paid_total": "0.00",
      "payment_due": "1.00",
      "all_tax_total": "0.00",
      "payment_discount_total": "0.00",
      "additional_total": "0.00",
      "duty_total": "0.00"
    },
    "except_notification": {
      "code": ""
    },
    "ip_address": {
      "country_code": "US",
      "province_name": "California",
      "country_name": "United States",
      "city": "Los Angeles",
      "ip": "203.0.113.10"
    },
    "policy_titles": [],
    "checkout_page_type": "three_step",
    "step": "contact_information"
  },
  "state": "success",
  "message": "",
  "errors": []
}
```

## 保存结账会话的配送地址

```text
POST /{locale}/api/checkout/order/presave
```

在支付前把配送地址存到会话上，以便按该地址计算运费和税费。

### 请求示例

**请求示例**

```javascript
const data = {
  order_token: '2446407200000000000000',
  shipping_address: {
    first_name: 'Jane',
    last_name: 'Doe',
    address: '123 Main St',
    city: 'Los Angeles',
    country: 'United States',
    country_code: 'US',
    province: 'California',
    province_code: 'CA',
    zip: '90001',
    email: 'jane@example.com'
  }
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/presave', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRF-Token': getCsrfToken()
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### 请求参数

**数据结构 | 示例**

- `order_token` string

  结账会话的 order token。
- `shipping_address` object

  要存到会话上的配送地址。

  - `first_name` string
  - `last_name` string
  - `phone` string
  - `email` string
  - `country` string
  - `country_code` string
  - `area` string
  - `address` string
  - `address1` string
  - `company` string
  - `province` string
  - `province_code` string
  - `city` string
  - `zip` string

```json
{
  "order_token": "2446407200000000000000",
  "shipping_address": {
    "first_name": "Jane",
    "last_name": "Doe",
    "address": "123 Main St",
    "city": "Los Angeles",
    "country": "United States",
    "country_code": "US",
    "province": "California",
    "province_code": "CA",
    "zip": "90001",
    "email": "jane@example.com"
  }
}
```

### 响应

**数据结构 | 示例**

- `data` string

  响应数据主体。
- `state` string

  请求结果标识，`success` 或 `0` 表示请求成功。
- `message` string

  响应返回的结果说明。
- `errors` undefined[]

  请求失败时返回的错误列表。

```json
{
  "data": null,
  "state": "success",
  "message": "",
  "errors": []
}
```

## 重新开启未付款会话的结账

```text
POST /{locale}/api/checkout/order/repay
```

对已创建但未支付的会话重新打开结账，并拿回它的结账地址。

### 请求示例

**请求示例**

```javascript
const data = { order_token: '2446407200000000000000' };

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/repay', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRF-Token': getCsrfToken()
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### 请求参数

**数据结构 | 示例**

- `order_token` string

  结账会话的 order token。

```json
{
  "order_token": "2446407200000000000000"
}
```

### 响应

**数据结构 | 示例**

- `data` object

  响应数据主体。

  - `id` string

    订单的 ID。
  - `checkout_url` string

    订单结账页的相对地址。
- `state` string

  请求结果标识，`success` 或 `0` 表示请求成功。
- `message` string

  响应返回的结果说明。
- `errors` undefined[]

  请求失败时返回的错误列表。

```json
{
  "data": {
    "id": "2446407200000000000000",
    "checkout_url": "/checkout/2446407200000000000000"
  },
  "state": "success",
  "message": "",
  "errors": []
}
```

## 提交结账会话去支付

```text
POST /{locale}/api/checkout/order/complete
```

提交结账会话去支付，一并带上地址、联系方式、选定的配送与支付方式，以及会话算出的金额。

### 请求示例

从 `GET /{locale}/api/checkout/order/{order_id}` 读取 `shipping_line`、`payment_line` 和 `prices`，原样回传，服务端才会按会话相同的口径计价。

**请求示例**

```javascript
const data = {
  order_token: '2446407200000000000000',
  shipping_address: {
    first_name: 'Jane',
    last_name: 'Doe',
    phone: '',
    email: 'jane@example.com',
    country: 'United States',
    country_code: 'US',
    area: '',
    address: '456 Oak Ave',
    address1: 'Apt 4',
    company: '',
    province: 'California',
    province_code: 'US-CA',
    city: 'Los Angeles',
    zip: '90002'
  },
  billing_address: {
    first_name: 'Jane',
    last_name: 'Doe',
    phone: '',
    email: 'jane@example.com',
    country: 'United States',
    country_code: 'US',
    area: '',
    address: '456 Oak Ave',
    address1: 'Apt 4',
    company: '',
    province: 'California',
    province_code: 'US-CA',
    city: 'Los Angeles',
    zip: '90002'
  },
  use_shipping_address: '1',
  customer_info: {
    email: 'jane@example.com',
    first_name: 'Jane',
    last_name: 'Doe',
    phone: '',
    newsletter: 0,
    note: '',
    save_address: 0,
    email_or_phone: 'jane@example.com'
  },
  shipping_line: {
    id: 'd43bfac3-5f80-433d-b9ce-49a3d645cd5c',
    name: 'Standard shipping',
    desc: '',
    delivery_method: 1,
    shipping_price: '1.00',
    discount_shipping_price: '1.00',
    discounts: [],
    is_free: false,
    support_cod: 0,
    location_id: '0',
    plan_code: ''
  },
  payment_line: {
    id: '59107222-a7a9-479a-a1f7-dd5d40015033',
    name: 'bogus',
    payment_channel: 'bogus',
    payment_method: 'bogus_gateway',
    payment_key: 'bogus',
    status: 'open',
    is_active: true
  },
  prices: {
    subtotal_price: '1.00',
    shipping_price: '0.00',
    tax_price: '0.00',
    discount_code_price: '0.00',
    discount_price: '0.00',
    total_price: '1.00',
    shipping_tax_total: '0.00',
    discount_line_item_price: '0.00',
    total_tip_received: '0.00',
    discount_shipping_price: '0.00',
    discount_sub_total: '1.00',
    gift_card_price: '0.00',
    paid_total: '0.00',
    payment_due: '1.00',
    all_tax_total: '0.00',
    payment_discount_total: '0.00',
    additional_total: '0.00',
    duty_total: '0.00'
  },
  risk_control_info: []
};

fetch(window.SHOPLAZZA.routes.root + '/api/checkout/order/complete', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-CSRF-Token': getCsrfToken()
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### 请求参数

**数据结构 | 示例**

- `order_token` string

  结账会话的 order token。
- `shipping_address` object

  订单的配送地址。

  - `first_name` string
  - `last_name` string
  - `phone` string
  - `email` string
  - `country` string
  - `country_code` string
  - `area` string
  - `address` string
  - `address1` string
  - `company` string
  - `province` string
  - `province_code` string
  - `city` string
  - `zip` string
- `billing_address` object

  订单的账单地址。

  - `first_name` string
  - `last_name` string
  - `phone` string
  - `email` string
  - `country` string
  - `country_code` string
  - `area` string
  - `address` string
  - `address1` string
  - `company` string
  - `province` string
  - `province_code` string
  - `city` string
  - `zip` string
- `use_shipping_address` string

  账单地址是否与配送地址相同，取值 `1` 或 `0`。
- `customer_info` object

  顾客的联系方式，以及是否订阅营销邮件、是否保存该地址。

  - `email` string
  - `first_name` string
  - `last_name` string
  - `phone` string
  - `newsletter` number
  - `note` string
  - `save_address` number
  - `email_or_phone` string
- `shipping_line` object

  从会话中选定的配送方式，原样回传会话响应里的对象。

  - `id` string
  - `name` string
  - `desc` string
  - `delivery_method` number
  - `shipping_price` string
  - `discount_shipping_price` string
  - `discounts` array
  - `is_free` boolean
  - `support_cod` number
  - `location_id` string
  - `plan_code` string
- `payment_line` object

  从会话中选定的支付方式，原样回传会话响应里的对象。

  - `id` string
  - `name` string
  - `payment_channel` string
  - `payment_method` string
  - `payment_key` string
  - `status` string
  - `is_active` boolean
- `prices` object

  会话算出的金额，原样回传会话响应里的对象。

  - `subtotal_price` string
  - `shipping_price` string
  - `tax_price` string
  - `discount_code_price` string
  - `discount_price` string
  - `total_price` string
  - `shipping_tax_total` string
  - `discount_line_item_price` string
  - `total_tip_received` string
  - `discount_shipping_price` string
  - `discount_sub_total` string
  - `gift_card_price` string
  - `paid_total` string
  - `payment_due` string
  - `all_tax_total` string
  - `payment_discount_total` string
  - `additional_total` string
  - `duty_total` string
- `risk_control_info` array

  为该订单采集的风控数据，没有采集时传空数组。

```json
{
  "order_token": "2446407200000000000000",
  "shipping_address": {
    "first_name": "Jane",
    "last_name": "Doe",
    "phone": "",
    "email": "jane@example.com",
    "country": "United States",
    "country_code": "US",
    "area": "",
    "address": "456 Oak Ave",
    "address1": "Apt 4",
    "company": "",
    "province": "California",
    "province_code": "US-CA",
    "city": "Los Angeles",
    "zip": "90002"
  },
  "billing_address": {
    "first_name": "Jane",
    "last_name": "Doe",
    "phone": "",
    "email": "jane@example.com",
    "country": "United States",
    "country_code": "US",
    "area": "",
    "address": "456 Oak Ave",
    "address1": "Apt 4",
    "company": "",
    "province": "California",
    "province_code": "US-CA",
    "city": "Los Angeles",
    "zip": "90002"
  },
  "use_shipping_address": "1",
  "customer_info": {
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Doe",
    "phone": "",
    "newsletter": 0,
    "note": "",
    "save_address": 0,
    "email_or_phone": "jane@example.com"
  },
  "shipping_line": {
    "id": "d43bfac3-5f80-433d-b9ce-49a3d645cd5c",
    "name": "Standard shipping",
    "desc": "",
    "delivery_method": 1,
    "shipping_price": "1.00",
    "discount_shipping_price": "1.00",
    "discounts": [],
    "is_free": false,
    "support_cod": 0,
    "location_id": "0",
    "plan_code": ""
  },
  "payment_line": {
    "id": "59107222-a7a9-479a-a1f7-dd5d40015033",
    "name": "bogus",
    "payment_channel": "bogus",
    "payment_method": "bogus_gateway",
    "payment_key": "bogus",
    "status": "open",
    "is_active": true
  },
  "prices": {
    "subtotal_price": "1.00",
    "shipping_price": "0.00",
    "tax_price": "0.00",
    "discount_code_price": "0.00",
    "discount_price": "0.00",
    "total_price": "1.00",
    "shipping_tax_total": "0.00",
    "discount_line_item_price": "0.00",
    "total_tip_received": "0.00",
    "discount_shipping_price": "0.00",
    "discount_sub_total": "1.00",
    "gift_card_price": "0.00",
    "paid_total": "0.00",
    "payment_due": "1.00",
    "all_tax_total": "0.00",
    "payment_discount_total": "0.00",
    "additional_total": "0.00",
    "duty_total": "0.00"
  },
  "risk_control_info": []
}
```

### 响应

**数据结构 | 示例**

- `data` object

  响应数据主体。

  - `except_notification` object

    完成订单时出现的异常信息。

    - `code` string

      异常代码，例如 `total_price_changed`。
- `state` string

  请求结果标识，`success` 或 `0` 表示请求成功。
- `message` string

  响应返回的结果说明。
- `errors` undefined[]

  请求失败时返回的错误列表。

```json
{
  "data": {
    "except_notification": {
      "code": "total_price_changed"
    }
  },
  "state": "success",
  "message": "",
  "errors": []
}
```
