---
title: "order.calculate"
method: POST
path: "/order.calculate.json"
tags: ["order"]
---

# order.calculate

`POST /order.calculate.json`

## Request

- Base URL: `https://api.api2cart.com/v1.1`
- URL: `https://api.api2cart.com/v1.1/order.calculate.json`
- Auth: API key in header `x-api-key` and API key in header `x-store-key`

Calculates the total cost of an order for a given customer and a set of products, as well as the available shipping methods based on the specified address. The calculation takes into account store product prices, discounts, taxes, shipping costs, and other store settings. The result includes a detailed breakdown of the final order cost by its components.

Note that the final totals, taxes, and other amounts must include the corresponding values for the selected shipping method.

The result of this method can be used when creating an order using the **order.add** method.

## Request body

- OrderCalculate
  - `customer_email` string, required: Defines the customer specified by email for whom the order needs to be calculated
  - `currency` string: Defines currency code
  - `currency_id` string: Currency Id
  - `store_id` string: Store Id
  - `coupons` string[]: Coupons that will be applied to order. If the order isn't eligible for any given discount code or there is no discount with such a code it will be skipped during calculation
  - `rounding_precision` integer: <p>Specifies the rounding precision for fractional numeric values (such as prices, taxes, and weights).</p> <p>Supported values range from <b>1</b> to <b>6</b>.</p> <p>The default rounding precision may vary depending on the platform. You can retrieve the default value using the <strong>cart.info</strong> method in the <code>default_rounding_precision</code> field. </p><p>Values are rounded to the nearest number at the specified precision. Fractions of .5 or higher are rounded up, while fractions lower than .5 are rounded down.</p>
  - `shipp_first_name` string, required: Specifies shipping first name
  - `shipp_last_name` string, required: Specifies shipping last name
  - `shipp_address_1` string, required: Specifies first shipping address
  - `shipp_address_2` string: Specifies second address line of a shipping street address
  - `shipp_city` string, required: Specifies shipping city
  - `shipp_postcode` string, required: Specifies shipping postcode
  - `shipp_state` string: Specifies shipping state code
  - `shipp_country` string, required: Specifies shipping country code
  - `shipp_company` string: Specifies shipping company
  - `shipp_phone` string: Specifies shipping phone
  - `bill_first_name` string: Specifies billing first name
  - `bill_last_name` string: Specifies billing last name
  - `bill_address_1` string: Specifies first billing address
  - `bill_address_2` string: Specifies second billing address
  - `bill_city` string: Specifies billing city
  - `bill_postcode` string: Specifies billing postcode
  - `bill_state` string: Specifies billing state code
  - `bill_country` string: Specifies billing country code
  - `bill_company` string: Specifies billing company
  - `bill_phone` string: Specifies billing phone
  - `response_fields` string: Set this parameter to choose which entity fields to retrieve. Use comma-separated field names in curly braces, nested to match the response structure, e.g. {result{product{id,name}}}. The wildcard * returns every field at a level: {*} gives the whole response, {result{product{*}}} all product fields.
  - `idempotency_key` string: A unique identifier associated with a specific request. Repeated requests with the same <strong>idempotency_key</strong> return a cached response without re-executing the business logic. <strong>Please note that the cache lifetime is 15 minutes.</strong>
  - `order_item` object[], required
    - `order_item_id` string, required: Defines orders specified by order item id
    - `order_item_quantity` integer, required: Defines orders specified by order item quantity
    - `order_item_variant_id` string: Ordered product variant. Where x is order item ID
    - `order_item_parent` integer: Index of the parent grouped/bundle product
    - `order_item_parent_option_name` string: Option name of the parent grouped/bundle product
    - `order_item_option` object[]
      - `order_item_option_name` string: Ordered Product Option Name. Where x is order item ID, y is order item option ID
      - `order_item_option_value` string: Ordered product option value Where x is order item ID, y - order item option ID

## Response `200`

successful operation

- object
  - `return_code` integer
  - `return_message` string
  - `result` OrderCalculate
    - `customer` BaseCustomer
      - `id` string
      - `email` string
      - `first_name` string, nullable
      - `last_name` string, nullable
      - `phone` string, nullable
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `subtotal` OrderCalculateSubtotal
      - `value` number
      - `tax` number
      - `discount` number
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `items` OrderCalculateItem[]
      - `product_id` string
      - `sku` string
      - `name` string
      - `quantity` integer
      - `price` number
      - `price_inc_tax` number
      - `tax_rate` number
      - `unit_discount` number
      - `weight` number, nullable
      - `weight_unit` string, nullable
      - `barcode` string, nullable
      - `variant_id` string, nullable
      - `bundle_product_id` string, nullable
      - `options` OrderItemOption[]
        - `option_id` string, nullable
        - `name` string
        - `value` string
        - `price` number
        - `weight` number, nullable
        - `type` string, nullable
        - `product_option_value_id` string, nullable
        - `additional_fields` object, nullable
        - `custom_fields` object, nullable
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `bundles` OrderCalculateBundle[]
      - `product_id` string
      - `sku` string
      - `name` string
      - `quantity` integer
      - `price` number
      - `price_inc_tax` number
      - `tax_rate` number
      - `unit_discount` number
      - `weight` number, nullable
      - `weight_unit` string, nullable
      - `barcode` string, nullable
      - `variant_id` string, nullable
      - `options` OrderItemOption[]
        - `option_id` string, nullable
        - `name` string
        - `value` string
        - `price` number
        - `weight` number, nullable
        - `type` string, nullable
        - `product_option_value_id` string, nullable
        - `additional_fields` object, nullable
        - `custom_fields` object, nullable
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `currency` Currency
      - `id` string
      - `name` string, nullable
      - `iso3` string
      - `symbol_left` string
      - `symbol_right` string, nullable
      - `rate` number, nullable
      - `avail` boolean, nullable
      - `default` boolean, nullable
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `shipping_rates` OrderCalculateShippingRate[]
      - `code` string
      - `name` string
      - `price` number
      - `price_inc_tax` number
      - `tax` number
      - `tax_rate` number
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `tax_lines` OrderCalculateTax[]
      - `code` string
      - `rate` number
      - `value` number
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `discounts` OrderCalculateDiscount[]
      - `code` string, nullable
      - `value` number
      - `type` string, nullable
      - `free_shipping` boolean, nullable
      - `additional_fields` object, nullable
      - `custom_fields` object, nullable
    - `additional_fields` object, nullable
    - `custom_fields` object, nullable

---

[API](https://skmtc.dev/api2cart/apis/api2cart-openapi.md) · [All operations](https://skmtc.dev/api2cart/apis/api2cart-openapi/llms.txt) · [OpenAPI document](https://skmtc.dev/api2cart/apis/api2cart-openapi/revisions/c34440741693?raw)
