# Checkout

The Checkout API opens a checkout session from storefront JavaScript and returns the URL to send the customer to. Themes use it for two flows: a **Buy now** button that takes one product straight to checkout without going through the cart, and a **Pay now** button that reopens payment for an order the customer left unpaid.

Every request other than `GET` must send an `X-CSRF-Token` header. See [Authentication](/docs/theme/references/ajax-api/customer#authentication) for how to read the token from the cookie. The bodies on this page are JSON, so set `Content-Type` to `application/json`.

All Ajax API requests should use [locale-aware URLs](/docs/theme/references/ajax-api/#locale-aware-urls) to give visitors a consistent experience.

## Create a checkout session

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

Create a checkout session for a set of variants. The response returns the `order_token` that the other endpoints on this page take, and the `checkout_url` the buyer is sent to.

### Example request

**Example request**

```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...
  });
```

### Request parameters

**Schema | Example**

- `line_items` object[]

  The variants to check out.

  *   Array \[

  - `product_id` string

    The product id of the variant.
  - `variant_id` string

    The variant id.
  - `quantity` number

    The quantity of the variant.
  *   \]
- `refer_info` object

  The source of the request. It has a `source` property whose values are `add_to_cart`, `buy_now`, or `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"
  }
}
```

### Response

**Schema | Example**

- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.
- `data` object

  The response payload.

  - `order_token` string

    Token that identifies the order.
  - `checkout_url` string

    Relative URL of the checkout page for the order.
  - `prices` object

    Amount breakdown of the order.

    - `total_price` string

      Total price of the cart after discounts.
    - `subtotal_price` string

      Sum of the line item prices before discounts.
    - `shipping_price` string

      Shipping fee of the order.
    - `tax_price` string

      Tax of the order.
    - `discount_price` string

      Total discount applied to the order.
    - `discount_line_item_price` string

      Discounted total for the applied discounts.
    - `discount_code_price` string

      Discount that comes from the discount code.
    - `currency_code` string

      Currency code of the order, for example `USD`.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `items` object[]

    List of line items in the cart.

    *   Array \[

    - `barcode` string

      Barcode of the variant.
    - `compare_at_price` string

      Compare-at price of the item.
    - `cost_price` string

      Cost price of the variant.
    - `custom` boolean

      Whether the line item is a custom item.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `discount_total` string

      Total discount applied.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `id` string

      ID of the line item.
    - `image` object

      Image of the line item's variant.

      - `alt` string

        Alt text of the image.
      - `height` number

        Height of the image, in pixels.
      - `path` string

        Path of the image file on the image server.
      - `src` string

        URL of the image.
      - `width` number

        Width of the image, in pixels.
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `note` string

      Note attached to the line item.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `price` string

      Price of a single unit of the line item.
    - `product_handle` string

      Handle of the product.
    - `product_id` string

      ID of the product.
    - `product_tags` undefined[]

      Tags of the product.
    - `product_title` string

      Title of the product.
    - `product_url` string

      Relative URL of the product page.
    - `properties` string

      Custom properties captured on the line item.
    - `quantity` number

      Quantity of the item.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `tax_code` string
    - `tax_price` string

      Tax of the line item.
    - `tax_rate` string

      Tax rate applied.
    - `taxable` boolean

      Whether tax is charged.
    - `trunk_price` string

      Trunk price of the line item.
    - `variant_id` string

      ID of the variant.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `total` string

      Total price of the line item.
    - `tax_lines` undefined[]

      Tax breakdown of the order.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `excluded_tax_sub_total` string
    - `length` number

      Package length of the line item.
    - `width` number

      Package width of the line item.
    - `height` number

      Package height of the line item.
    - `dimension_unit` string

      Unit of the package dimensions.
    - `hs_code` string

      HS code used for the customs declaration.
    - `origin_country_code` string

      Country code where the product was produced.
    - `origin_price` string
    - `duty_price` string

      Customs duty of the line item.
    - `product_type` string

      Product type.
    *   \]
  - `key` string

    Key required, together with the order ID, to open the checkout page.
  - `line_items` object[]

    List of line items.

    *   Array \[

    - `barcode` string

      Barcode of the variant.
    - `compare_at_price` string

      Compare-at price of the item.
    - `cost_price` string

      Cost price of the variant.
    - `custom` boolean

      Whether the line item is a custom item.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `discount_total` string

      Total discount applied.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `id` string

      ID of the line item.
    - `image` object

      Image of the line item's variant.

      - `alt` string

        Alt text of the image.
      - `height` number

        Height of the image, in pixels.
      - `path` string

        Path of the image file on the image server.
      - `src` string

        URL of the image.
      - `width` number

        Width of the image, in pixels.
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `note` string

      Note attached to the line item.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `price` string

      Price of a single unit of the line item.
    - `product_handle` string

      Handle of the product.
    - `product_id` string

      ID of the product.
    - `product_tags` undefined[]

      Tags of the product.
    - `product_title` string

      Title of the product.
    - `product_url` string

      Relative URL of the product page.
    - `properties` string

      Custom properties captured on the line item.
    - `quantity` number

      Quantity of the item.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `tax_code` string
    - `tax_price` string

      Tax of the line item.
    - `tax_rate` string

      Tax rate applied.
    - `taxable` boolean

      Whether tax is charged.
    - `trunk_price` string

      Trunk price of the line item.
    - `variant_id` string

      ID of the variant.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `total` string

      Total price of the line item.
    - `tax_lines` undefined[]

      Tax breakdown of the order.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `excluded_tax_sub_total` string
    - `length` number

      Package length of the line item.
    - `width` number

      Package width of the line item.
    - `height` number

      Package height of the line item.
    - `dimension_unit` string

      Unit of the package dimensions.
    - `hs_code` string

      HS code used for the customs declaration.
    - `origin_country_code` string

      Country code where the product was produced.
    - `origin_price` string
    - `duty_price` string

      Customs duty of the line item.
    - `product_type` string

      Product type.
    *   \]
  - `invalid_line_items` undefined[]

    Line items that could not be placed into the order.
  - `redirect_url` string

    URL the customer should be redirected to.

```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": ""
  }
}
```

## Get a checkout session

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

Get the current state of a checkout session, where `order_id` is the order token from the checkout URL.

### Example request

**Example request**

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

### Request parameters

- `order_id` string

  The order token returned when the checkout session was created.

### Response

**Schema | Example**

- `data` object

  The response payload.

  - `id` string

    ID of the order.
  - `refer_info` object

    Information about how the customer reached the store.

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

      The visitor's IP address.
    - `seg` string
    - `session_id` string
    - `source` string
    - `user_agent` string
  - `order_no` string

    Order number.
  - `create_time` string

    Time when the order was created; same as `create_at`.
  - `placed_at` string

    Time when the order was paid.
  - `status` string

    Status of the order, for example `opened`, `placed`, `finished`.
  - `financial_status` string

    Payment status of the order, for example `waiting`, `paid`.
  - `fulfillment_status` string

    Fulfillment status, for example `waiting`, `shipped`, `finished`.
  - `post_sale_status` string

    After-sales status of the order.
  - `email_status` string

    Status of the order recall email; `waiting` pending, `send` sent.
  - `note` string

    Note the merchant added to the order.
  - `cancel_reason` string

    Reason the order was cancelled.
  - `discount_code` string

    Discount code applied to the order.
  - `customer_note` string

    Note the customer left during checkout.
  - `currency_code` string

    Currency code of the order, for example `USD`.
  - `shipping_address_editable` boolean

    Whether the shipping address can still be edited.
  - `config` object

    Configuration of the order.

    - `page_type` string

      Layout of the checkout page, for example `three_step`.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `checkout_business_type` number
    - `product_tax_included` boolean

      Whether product prices include tax.
    - `checkout_template_type` number
    - `market_setting` object

      Market settings that apply to the order.

      - `primary_market_lang` string

        Language code of the store's primary market.
      - `market_lang` string

        Language code of the market.
      - `market_id` string

        ID of the market the order belongs to.
      - `market_currency` string

        Currency code of the market.
      - `market_currency_symbol` object

        Currency symbol of the market.

        - `code` string

          Currency code, for example `USD`.
        - `val` string

          Currency symbol, for example `$`.
        - `left` string

          Content shown to the left of the amount.
        - `right` string

          Content shown to the right of the amount.
      - `market_base_currency` string

        Base currency code of the market.
      - `market_base_currency_symbol` object

        Symbol of the base currency of the market.

        - `code` string

          Currency code, for example `USD`.
        - `val` string

          Currency symbol, for example `$`.
        - `left` string

          Content shown to the left of the amount.
        - `right` string

          Content shown to the right of the amount.
      - `primary_market_id` string

        ID of the store's primary market.
      - `primary_market_currency` string

        Currency code of the store's primary market.
      - `primary_market_currency_symbol` object

        Currency symbol of the store's primary market.

        - `code` string

          Currency code, for example `USD`.
        - `val` string

          Currency symbol, for example `$`.
        - `left` string

          Content shown to the left of the amount.
        - `right` string

          Content shown to the right of the amount.
      - `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

        Country code of the market.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `canceled_at` string

    Time when the order was cancelled.
  - `fail_code` string
  - `shipping_line` undefined[]

    Shipping plan selected for the order.
  - `customer` object

    The customer details.

    - `id` string

      ID of the customer.
    - `email` string

      Email address of the customer.
    - `first_name` string

      First name of the customer or recipient.
    - `last_name` string

      Last name of the customer or recipient.
    - `phone` string

      Phone number of the customer.
    - `tags` undefined[]

      Tags attached to the object.
    - `subscribed` boolean

      Whether the customer is subscribed to marketing messages.
    - `name` string

      Full name of the customer.
    - `note` string

      Note attached to the object.
    - `contact` string

      Contact of the customer, either an email address or a phone number.
    - `contact_type` string

      Contact type, either email or phone.
    - `created_at` string

      Creation time, in ISO-8601 format.
    - `registered` boolean

      Whether the customer has registered an account.
    - `registered_at` string

      Time when the customer completed registration.
    - `source` string

      Where the customer record came from.
    - `free_tax` string

      Whether the customer is exempt from taxes.
    - `location_id` string
    - `customer_extra_info` object

      Additional statistics about the customer.

      - `finished_order_count` number

        Number of completed orders placed by the customer.
      - `finished_order_total` string

        Total amount of the completed orders placed by the customer.
      - `country` string
      - `country_code` string
      - `province` string

        Province or state of the address.
      - `province_code` string

        Province or state code.
      - `currency_code` string

        Currency code of the order, for example `USD`.
      - `purchase_product_count` number

        Number of products the customer has purchased.
      - `store_customer_id` string
      - `customer_role` string
      - `ext` string
      - `first_order_at` string

        Time when the customer placed the first order.
      - `last_order_at` string

        Time when the customer placed the last order.
  - `shipping_address` object

    Shipping address of the order.

    - `id` string

      ID of the address.
    - `first_name` string

      First name of the customer or recipient.
    - `last_name` string

      Last name of the customer or recipient.
    - `email` string

      Email address associated with the address.
    - `phone` string

      Phone number associated with the address.
    - `country_code` string

      ISO country code of the address.
    - `country` string

      Country name of the address.
    - `province_code` string

      Province or state code.
    - `province` string

      Province or state of the address.
    - `area` string

      Area or district of the address.
    - `city` string

      City of the address.
    - `address` string

      Street address of the recipient.
    - `address1` string

      Primary street address.
    - `zip` string

      Postal or ZIP code.
    - `extra_info` string
    - `company` string

      Company name of the address.
    - `phone_area_code` string

      Area code of the phone number.
    - `latitude` string

      Latitude of the address.
    - `longitude` string

      Longitude of the address.
    - `source` string
    - `tags` string

      Tags attached to the object.
  - `billing_address` string

    Billing address of the order.
  - `line_items` object[]

    List of line items.

    *   Array \[

    - `id` string

      ID of the line item.
    - `product_title` string

      Title of the product.
    - `product_id` string

      ID of the product.
    - `product_handle` string

      Handle of the product.
    - `variant_id` string

      ID of the variant.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `quantity` number

      Quantity of the item.
    - `fulfillment_status` string

      Fulfillment status, for example `waiting`, `shipped`, `finished`.
    - `note` string

      Note attached to the line item.
    - `image` object

      Image of the line item's variant.

      - `alt` string

        Alt text of the image.
      - `height` number

        Height of the image, in pixels.
      - `path` string

        Path of the image file on the image server.
      - `src` string

        URL of the image.
      - `width` number

        Width of the image, in pixels.
    - `compare_at_price` string

      Compare-at price of the item.
    - `price` string

      Price of a single unit of the line item.
    - `total` string

      Total price of the line item.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `taxable` boolean

      Whether tax is charged.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `vendor` string

      Vendor of the product.
    - `product_url` string

      Relative URL of the product page.
    - `properties` string

      Custom properties captured on the line item.
    - `barcode` string

      Barcode of the variant.
    - `product_spu` string

      SPU of the product.
    - `product_vendor_url` string

      URL of the product vendor.
    - `product_tags` undefined[]

      Tags of the product.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `tax_code` string
    - `tax_rate` string

      Tax rate applied.
    - `tax_price` string

      Tax of the line item.
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `price` string

        Unit price of this wholesale tier.
      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      *   \]
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `item_price` string
    - `cost_price` string

      Cost price of the variant.
    - `custom` boolean

      Whether the line item is a custom item.
    - `trunk_price` string

      Trunk price of the line item.
    - `main_currency_prices` object

      Order amounts converted into the store's main currency.

      - `compare_at_price` string

        Compare-at price of the item.
      - `price` string

        Unit price converted into the store's main currency.
      - `total` string

        Total converted into the store's main currency.
      - `tax_price` string

        Tax of the line item.
      - `item_price` string
      - `cost_price` string

        Cost price of the variant.
      - `trunk_price` string

        Trunk price of the line item.
      - `actual_rate` string

        Exchange rate used for the conversion.
    - `fixed_discount_total` string
    - `excluded_tax_sub_total` string
    - `tax_lines` undefined[]

      Tax breakdown of the order.
    - `length` number

      Package length of the line item.
    - `width` number

      Package width of the line item.
    - `height` number

      Package height of the line item.
    - `dimension_unit` string

      Unit of the package dimensions.
    - `commission` string
    - `origin_country_code` string

      Country code where the product was produced.
    - `hs_code` string

      HS code used for the customs declaration.
    - `created_by` string
    - `origin_price` string
    - `duty_price` string

      Customs duty of the line item.
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `discount_total` string

      Total discount applied.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    *   \]
  - `payment_line` string

    Payment details of the order.
  - `test` boolean

    Whether this is a test order.
  - `order_status_url` string

    Relative URL of the order status page.
  - `order_key` string

    Key used together with the order ID to access the order.
  - `yet_payment` string

    Amount of the order that is still unpaid.
  - `refund` string

    Refunded amount of the order.
  - `installment_fee` string

    Installment fee charged on the order.
  - `paid_total` string

    Total amount already paid for the order.
  - `updated_time` string

    Time when the order was last updated.
  - `checkout_id` string
  - `tax_type` number
  - `applied_gift_cards` undefined[]

    Gift cards applied to the order.
  - `payment_lines` undefined[]

    List of the order payment records.
  - `checkout_url` string

    Relative URL of the checkout page for the order.
  - `finished_at` string

    Time when the order was completed.
  - `fulfillments` undefined[]

    List of shipments for the order.
  - `identifier_extra` string
  - `main_currency_prices` object

    Order amounts converted into the store's main currency.

    - `sub_total` string

      Sum of the line item prices before order-level discounts.
    - `shipping_total` string

      Total shipping fee of the order.
    - `tax_total` string

      Total tax applied to the order.
    - `discount_total` string

      Total discount applied.
    - `total` string

      Total converted into the store's main currency.
    - `total_tip_received` string

      Total tip received for the order.
    - `refund_total` string

      Total refunded amount of the order.
    - `actual_rate` string

      Exchange rate used for the conversion.
  - `shipping_line_detail` string
  - `order_type` number

    Order type; `0` is a regular order, `1` is a gift card order.
  - `shipping_tax_type` number
  - `product_tax_included` boolean

    Whether product prices include tax.
  - `translations` undefined[]
  - `location_line` object

    Address of the merchant's warehouse.

    - `id` string

      ID of the address.
    - `location_id` string

      ID of the warehouse.
    - `location_name` string

      Name of the warehouse.
    - `first_name` string

      First name of the customer or recipient.
    - `last_name` string

      Last name of the customer or recipient.
    - `phone` string

      Phone number associated with the address.
    - `email` string

      Email address associated with the address.
    - `country` string

      Country name of the address.
    - `country_code` string

      ISO country code of the address.
    - `province` string

      Province or state of the address.
    - `province_code` string

      Province or state code.
    - `area` string

      Area or district of the address.
    - `city` string

      City of the address.
    - `address` string

      Street address of the recipient.
    - `address1` string

      Primary street address.
    - `company` string

      Company name of the address.
    - `latitude` string

      Latitude of the address.
    - `longitude` string

      Longitude of the address.
    - `zip` string

      Postal or ZIP code.
    - `phone_area_code` string

      Area code of the phone number.
    - `extra_info` string
  - `additional_total` string

    Total additional charges of the order.
  - `additional_prices` undefined[]

    Breakdown of the additional charges.
  - `tax_lines` object

    Tax breakdown of the order.

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

    Tags attached to the object.
  - `order_customer` object

    Customer information recorded on the order.

    - `origin_id` string
    - `first_name` string

      First name of the customer or recipient.
    - `last_name` string

      Last name of the customer or recipient.
    - `email` string

      Email address of the customer.
    - `phone` string

      Phone number of the customer.
    - `customer_role` string
    - `ext` undefined[]
  - `duty_total` string

    Total customs duty and tax of the order.
  - `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

    Checkout settings of the store.

    - `customer_authority` string
    - `checkout_page_type` string

      Layout of the checkout page, for example `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

        How the name fields are laid out in the address form.
      - `email` string

        Display setting of the email field in the address form.
      - `phone` string

        Display setting of the phone field in the address form.
      - `company` string

        Display setting of the company field in the address form, for example `hidden`.
      - `address` string

        Display setting of the street address field in the address form.
      - `address1` string

        Display setting of the street address field in the address form.
      - `name_requirement` string

        Which name field is required, for example `last_name`.
      - `contact_details` string

        How contact fields are collected in the address form.
    - `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

    How the address form is configured.

    - `name` string

      How the name fields are laid out in the address form.
    - `email` string

      Display setting of the email field in the address form.
    - `phone` string

      Display setting of the phone field in the address form.
    - `company` string

      Display setting of the company field in the address form, for example `hidden`.
    - `address` string

      Display setting of the street address field in the address form.
    - `address1` string

      Display setting of the street address field in the address form.
    - `name_requirement` string

      Which name field is required, for example `last_name`.
    - `contact_details` string

      How contact fields are collected in the address form.
  - `customer_info` object

    Contact information filled in at checkout.

    - `email` string

      Email address of the customer.
    - `first_name` string

      First name of the customer or recipient.
    - `last_name` string

      Last name of the customer or recipient.
    - `phone` string

      Phone number of the customer.
  - `payment_settings` object

    Payment settings available at checkout.

    - `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 that identifies the order.
  - `currency_symbol` string

    Currency symbol of the order.
  - `currency_symbol_pos` string

    Where the currency symbol is placed, `left` or `right`.
  - `payment_due` string

    Amount of the order that is still unpaid.
  - `all_tax_total` string

    Total of all taxes on the order.
  - `prices` object

    Amount breakdown of the order.

    - `subtotal_price` string

      Sum of the line item prices before discounts.
    - `shipping_price` string

      Shipping fee of the order.
    - `tax_price` string

      Tax of the order.
    - `discount_code_price` string

      Discount that comes from the discount code.
    - `discount_price` string

      Total discount applied to the order.
    - `total_price` string

      Total price of the cart after discounts.
    - `shipping_tax_total` string

      Total shipping tax of the order.
    - `discount_line_item_price` string

      Discounted total for the applied discounts.
    - `total_tip_received` string

      Total tip received for the order.
    - `discount_shipping_price` string

      Discount applied to the shipping fee.
    - `discount_sub_total` string

      Subtotal after discounts.
    - `gift_card_price` string

      Amount paid with gift cards.
    - `paid_total` string

      Total amount already paid for the order.
    - `payment_due` string

      Amount of the order that is still unpaid.
    - `all_tax_total` string

      Total of all taxes on the order.
    - `payment_discount_total` string

      Discount that comes from the payment method.
    - `additional_total` string

      Total additional charges of the order.
    - `duty_total` string

      Total customs duty and tax of the order.
  - `except_notification` object

    Information about an exception raised while completing the order.

    - `code` string

      Exception code, for example `total_price_changed`.
  - `ip_address` object

    Location resolved from the customer's IP address.

    - `country_code` string

      Country code resolved from the customer's IP address.
    - `province_name` string

      Province name resolved from the customer's IP address.
    - `country_name` string

      Country name resolved from the customer's IP address.
    - `city` string

      City of the address.
    - `ip` string

      The visitor's IP address.
  - `policy_titles` undefined[]

    Titles of the store policies shown at checkout.
  - `checkout_page_type` string

    Layout of the checkout page, for example `three_step`.
  - `step` string

    Current step of the checkout flow.
- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.

```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": []
}
```

## Save a shipping address on a checkout session

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

Save a shipping address on the session before payment, so that shipping rates and taxes can be calculated for it.

### Example request

**Example request**

```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...
  });
```

### Request parameters

**Schema | Example**

- `order_token` string

  The order token of the checkout session.
- `shipping_address` object

  The shipping address to save on the session.

  - `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"
  }
}
```

### Response

**Schema | Example**

- `data` string

  The response payload.
- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.

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

## Reopen the checkout of an unpaid session

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

Reopen the checkout of a session that was created but not paid, and get its checkout URL back.

### Example request

**Example request**

```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...
  });
```

### Request parameters

**Schema | Example**

- `order_token` string

  The order token of the checkout session.

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

### Response

**Schema | Example**

- `data` object

  The response payload.

  - `id` string

    ID of the order.
  - `checkout_url` string

    Relative URL of the checkout page for the order.
- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.

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

## Submit a checkout session for payment

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

Submit the checkout session for payment with the addresses, the contact details, the chosen shipping and payment options and the prices that the session settled on.

### Example request

Read `shipping_line`, `payment_line` and `prices` from `GET /{locale}/api/checkout/order/{order_id}` and send them back unchanged, so that the server prices the order the same way the session did.

**Example request**

```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...
  });
```

### Request parameters

**Schema | Example**

- `order_token` string

  The order token of the checkout session.
- `shipping_address` object

  The shipping address of the order.

  - `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

  The billing address of the order.

  - `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

  Whether the billing address is the same as the shipping address, `1` or `0`.
- `customer_info` object

  The contact details of the buyer, and whether to subscribe them and save their address.

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

  The shipping option chosen from the session, copied from the session response.

  - `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

  The payment option chosen from the session, copied from the session response.

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

  The prices the session settled on, copied from the session response.

  - `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

  The risk control data collected for the order. Pass an empty array when you collect none.

```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": []
}
```

### Response

**Schema | Example**

- `data` object

  The response payload.

  - `except_notification` object

    Information about an exception raised while completing the order.

    - `code` string

      Exception code, for example `total_price_changed`.
- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.

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