> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kibocommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Estimate Order Tax

> Retrieves a tax context for the given order.



## OpenAPI

````yaml /openapi/openapi_pricing.json post /commerce/catalog/storefront/tax/estimate-order
openapi: 3.0.1
info:
  description: OpenAPI Spec for Kibo PricingRuntime Service
  title: Pricing Storefront
  version: 0.0.1
servers:
  - description: Kibo Base URL
    url: '{baseUrl}/api'
    variables:
      baseUrl:
        default: https://t1000000.sb.usc1.gcp.kibocommerce.com
        description: Base URL
security:
  - bearerAuth: []
paths:
  /commerce/catalog/storefront/tax/estimate-order:
    post:
      tags:
        - Taxes
      summary: Estimate Order Tax
      description: Retrieves a tax context for the given order.
      parameters:
        - description: limits which fields are returned in the response body
          in: query
          name: responseFields
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaxableOrder'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderTaxContext'
            text/json:
              schema:
                $ref: '#/components/schemas/OrderTaxContext'
            text/plain:
              schema:
                $ref: '#/components/schemas/OrderTaxContext'
          description: OK
components:
  schemas:
    TaxableOrder:
      description: Properties of a taxable order
      properties:
        attributes:
          items:
            $ref: '#/components/schemas/TaxAttribute'
          nullable: true
          type: array
        currencyCode:
          description: The currency code for this order
          nullable: true
          type: string
        data:
          nullable: true
          type: object
        handlingDiscount:
          $ref: '#/components/schemas/PricingRuntimeAppliedDiscount'
        handlingDiscounts:
          description: >-
            The list of historically-applied handling discounts.  The active one
            will have IsExcluded == false
          items:
            $ref: '#/components/schemas/PricingRuntimeAppliedDiscount'
          nullable: true
          type: array
        handlingFee:
          description: Handling Fee
          format: double
          type: number
        lineItems:
          description: List of taxable items.
          items:
            $ref: '#/components/schemas/TaxableLineItem'
          nullable: true
          type: array
        orderDate:
          description: "Date on which the order is/was submitted.\r\nCannot be a future date."
          format: date-time
          type: string
        orderDiscount:
          $ref: '#/components/schemas/PricingRuntimeAppliedDiscount'
        orderDiscounts:
          description: >-
            The discount that has been applied to the cart itself. If multiple
            discounts exist, this is the discount that the system applies
            because it offers the best savings for the shopper. This is a
            negative number.
          items:
            $ref: '#/components/schemas/PricingRuntimeAppliedDiscount'
          nullable: true
          type: array
        orderId:
          nullable: true
          type: string
        orderNumber:
          format: int32
          nullable: true
          type: integer
        originalDocumentCode:
          description: >-
            The order id of the original order.  This can be used to track
            changes to the order for taxing purposes.
          nullable: true
          type: string
        originalOrderDate:
          description: >-
            The date of the original order.  This is used when calculating
            changes to the Taxable Order, evaluating them at this time rather
            than the present.
          format: date-time
          type: string
        shippingAmount:
          description: Shipping Amount rolled up for the order
          format: double
          type: number
        shippingDiscount:
          $ref: '#/components/schemas/AppliedOrderShippingDiscount'
        shippingDiscounts:
          description: >-
            The list of historically-applied shipping discounts.  The active one
            will have IsExcluded == false
          items:
            $ref: '#/components/schemas/AppliedOrderShippingDiscount'
          nullable: true
          type: array
        shippingMethodCode:
          description: "Code that uniquely identifies the shipping method such as \"Ground,\" \"Overnight,\" or \"Digital.\"\r\nThe site's shipping settings lists the valid shipping methods specified for this site."
          nullable: true
          type: string
        shippingMethodName:
          description: Readable name of the shipping method
          nullable: true
          type: string
        taxContext:
          $ref: '#/components/schemas/TaxContext'
        taxRequestType:
          description: >-
            Used to differentiate between an Order and a Return being used as
            the source of this Taxable Order
          nullable: true
          type: string
      type: object
    OrderTaxContext:
      properties:
        handlingFeeTax:
          description: The handling fee tax amount for this line item
          format: double
          type: number
        itemTaxContexts:
          description: Taxes applied to each item in the order.
          items:
            $ref: '#/components/schemas/ItemTaxContext'
          nullable: true
          type: array
        orderTax:
          description: Rollup tax on the order not including shipping
          format: double
          type: number
        shippingTax:
          description: Rollup shipping tax for this order
          format: double
          type: number
        taxData:
          description: Storage for any additional/custom tax data.
          nullable: true
          type: object
      type: object
    TaxAttribute:
      properties:
        attributeDefinitionId:
          format: int32
          nullable: true
          type: integer
        fullyQualifiedName:
          nullable: true
          type: string
        values:
          items: {}
          nullable: true
          type: array
      type: object
    PricingRuntimeAppliedDiscount:
      description: "Details of the applied discount, including how much the shopper saves if the discount is applied and the coupon\r\ncode\r\nrequired to redeem the discount, if any."
      properties:
        couponCode:
          description: >-
            Code of the coupon associated with the discount (if a coupon code is
            required in order to receive the discount).
          nullable: true
          type: string
        couponSetId:
          description: Contains coupon set id if there is one
          format: int32
          nullable: true
          type: integer
        discount:
          $ref: '#/components/schemas/PricingRuntimeDiscount'
        impact:
          description: >-
            Value of the discount, that is how much the shopper saves if
            discount is applied.
          format: double
          type: number
      type: object
    TaxableLineItem:
      properties:
        data:
          nullable: true
          type: object
        destinationAddress:
          $ref: '#/components/schemas/CommerceRuntimeAddress'
        discountTotal:
          description: >-
            How much the shopper saves with the applied discount or sale price.
            This is a negative number.
          format: double
          nullable: true
          type: number
        discountedTotal:
          description: Subtotal minus any discounts.
          format: double
          nullable: true
          type: number
        feeTotal:
          description: Not implemented. Total cost of fees that apply to this item.
          format: double
          nullable: true
          type: number
        handlingAmount:
          description: Handling Amount for this item
          format: double
          nullable: true
          type: number
        id:
          description: Unique identifier of the line item.
          nullable: true
          type: string
        isTaxable:
          description: Is the Product taxable
          nullable: true
          type: boolean
        lineItemPrice:
          description: The line item subtotal of quantity * Product.TaxablePrice
          format: double
          type: number
        originAddress:
          $ref: '#/components/schemas/CommerceRuntimeAddress'
        productCode:
          description: Unique code of the product.
          nullable: true
          type: string
        productDiscount:
          $ref: '#/components/schemas/PricingRuntimeAppliedLineItemProductDiscount'
        productDiscounts:
          description: A list of discounts applied to the product
          items:
            $ref: '#/components/schemas/PricingRuntimeAppliedLineItemProductDiscount'
          nullable: true
          type: array
        productName:
          description: Name of the product.
          nullable: true
          type: string
        productProperties:
          description: Custom Properties of the product (i.e. inclues TaxCode)
          items:
            $ref: '#/components/schemas/PricingRuntimeProductProperty'
          nullable: true
          type: array
        quantity:
          description: The number of products for this line item
          format: int32
          type: integer
        reason:
          description: Clarifications on the reason this item is being taxed/returned?
          nullable: true
          type: string
        shippingAmount:
          description: The line item shipping amount.
          format: double
          type: number
        shippingDiscount:
          $ref: '#/components/schemas/PricingRuntimeAppliedLineItemShippingDiscount'
        shippingDiscounts:
          description: A discount applied to the shipping
          items:
            $ref: '#/components/schemas/PricingRuntimeAppliedLineItemShippingDiscount'
          nullable: true
          type: array
        variantProductCode:
          description: >-
            For configurable products, the unique identifier of the product
            variation that has been selected.
          nullable: true
          type: string
      type: object
    AppliedOrderShippingDiscount:
      properties:
        couponCode:
          description: >-
            Code of the coupon associated with the discount (if a coupon code is
            required in order to receive the discount).
          nullable: true
          type: string
        couponSetId:
          description: Contains coupon set id if there is one
          format: int32
          nullable: true
          type: integer
        discount:
          $ref: '#/components/schemas/PricingRuntimeDiscount'
        impact:
          description: >-
            Value of the discount, that is how much the shopper saves if
            discount is applied.
          format: double
          type: number
        shippingMethodCode:
          description: Unique identifier of the shipping method discount.
          nullable: true
          type: string
      type: object
    TaxContext:
      description: The context for the tax calculation.
      properties:
        customerId:
          description: >-
            A unique id for a customer.  This may be the userid, checking with
            Avalara to determine the meaning of this
          nullable: true
          type: string
        destinationAddress:
          $ref: '#/components/schemas/CommerceRuntimeAddress'
        originAddress:
          $ref: '#/components/schemas/CommerceRuntimeAddress'
        taxContextId:
          description: >-
            The unique id of this context. Will typically be the OrderId or
            CartId, depending when the tax is being calculated.
          nullable: true
          type: string
        taxExemptId:
          description: >-
            Tax exemption id.  Indicates that this customer or user is tax
            exempt
          nullable: true
          type: string
      type: object
    ItemTaxContext:
      description: The tax applied to an individual order item.
      properties:
        duty:
          description: Duty Amount for this line item
          format: double
          nullable: true
          type: number
        id:
          description: Unique identifier of the line item.
          nullable: true
          type: string
        productCode:
          description: Merchant-created code that uniquely identifies the product.
          nullable: true
          type: string
        quantity:
          description: The number of products in this lineitem
          format: int32
          type: integer
        shippingTax:
          description: The shipping tax amount for this line item
          format: double
          type: number
        tax:
          description: Line item tax amount not including shipping
          format: double
          type: number
        taxData:
          description: Storage for any additional/custom tax data.
          nullable: true
          type: object
      type: object
    PricingRuntimeDiscount:
      description: "Name of the discount that can be applied and its expiration date. The discount can be on a single product or the\r\nentire order."
      properties:
        amount:
          format: double
          type: number
        amountType:
          description: >-
            Type of discount, which can be either a percentage off the price, a
            specific monetary amount, or free. Possible values: "Percentage,"
            "Amount," and "Free".
          nullable: true
          type: string
        code:
          description: Unique identifier of the discount.
          nullable: true
          type: string
        condition:
          $ref: '#/components/schemas/PricingRuntimeDiscountCondition'
        discountId:
          description: Unique identifier of the discount. System-supplied and read-only.
          format: int32
          type: integer
        doesNotApplyToMultiShipToOrders:
          nullable: true
          type: boolean
        doesNotApplyToProductsWithSalePrice:
          type: boolean
        expirationDate:
          deprecated: true
          description: When the discount expires. If null, there's no expiration date.
          format: date-time
          nullable: true
          type: string
        friendlyDescription:
          description: Friendly description of the discount.
          nullable: true
          type: string
        includedPriceLists:
          items:
            type: string
          nullable: true
          type: array
        isPublic:
          nullable: true
          type: boolean
        labels:
          items:
            type: string
          nullable: true
          type: array
        maxDiscountValuePerRedemption:
          format: double
          nullable: true
          type: number
        maxRedemptions:
          format: int32
          nullable: true
          type: integer
        maximumDiscountValuePerOrder:
          format: double
          nullable: true
          type: number
        maximumRedemptionsPerOrder:
          format: int32
          nullable: true
          type: integer
        maximumUsesPerUser:
          format: int32
          nullable: true
          type: integer
        name:
          description: Name of the discount.
          nullable: true
          type: string
        redemptions:
          format: int32
          type: integer
        requiresAuthenticatedUser:
          type: boolean
        scope:
          nullable: true
          type: string
        stackingLayer:
          format: int32
          type: integer
        target:
          $ref: '#/components/schemas/PricingRuntimeDiscountTarget'
        type:
          nullable: true
          type: string
      type: object
    CommerceRuntimeAddress:
      properties:
        address1:
          nullable: true
          type: string
        address2:
          nullable: true
          type: string
        address3:
          nullable: true
          type: string
        address4:
          nullable: true
          type: string
        addressType:
          nullable: true
          type: string
        cityOrTown:
          nullable: true
          type: string
        countryCode:
          nullable: true
          type: string
        isValidated:
          nullable: true
          type: boolean
        postalOrZipCode:
          nullable: true
          type: string
        stateOrProvince:
          nullable: true
          type: string
      type: object
    PricingRuntimeAppliedLineItemProductDiscount:
      properties:
        appliesToSalePrice:
          description: "Indicates that this discount is to be applied to the sale price if true or the list price if false.\r\nThis only applies to product and line item discounts."
          type: boolean
        couponCode:
          description: >-
            Code of the coupon associated with the discount (if a coupon code is
            required in order to receive the discount).
          nullable: true
          type: string
        couponSetId:
          description: Contains coupon set id if there is one
          format: int32
          nullable: true
          type: integer
        discount:
          $ref: '#/components/schemas/PricingRuntimeDiscount'
        impact:
          description: >-
            Value of the discount, that is how much the shopper saves if
            discount is applied.
          format: double
          type: number
        impactPerUnit:
          description: "Discount impact per unit for the quantity applied.\r\nThis value is not rounded.\r\nImpactPerUnit * Quantity = Impact @ Quantity"
          format: double
          type: number
        isForced:
          description: >-
            Signifies that the discount is forced and not applied via best
            match.
          type: boolean
        normalizedImpact:
          format: double
          type: number
        quantity:
          description: Quantity of items from the line item that the discount applies to.
          format: int32
          type: integer
      type: object
    PricingRuntimeProductProperty:
      description: Duplicate definition from ProductRuntime
      properties:
        attributeDetail:
          $ref: '#/components/schemas/ProductAttribute'
        attributeFQN:
          description: Attribute fully qualified name
          nullable: true
          type: string
        isHidden:
          description: >-
            Indicates whether the product property should be hidden from the
            customer
          nullable: true
          type: boolean
        isMultiValue:
          description: >-
            Indicates whether it's possible for there to be more than one value
            in the Values field
          nullable: true
          type: boolean
        values:
          description: Value(s) of the product property
          items:
            $ref: '#/components/schemas/PricingRuntimeProductPropertyValue'
          nullable: true
          type: array
      type: object
    PricingRuntimeAppliedLineItemShippingDiscount:
      properties:
        couponCode:
          description: >-
            Code of the coupon associated with the discount (if a coupon code is
            required in order to receive the discount).
          nullable: true
          type: string
        couponSetId:
          description: Contains coupon set id if there is one
          format: int32
          nullable: true
          type: integer
        discount:
          $ref: '#/components/schemas/PricingRuntimeDiscount'
        impact:
          description: >-
            Value of the discount, that is how much the shopper saves if
            discount is applied.
          format: double
          type: number
        impactPerUnit:
          description: "Discount impact per unit for the quantity applied.\r\nThis value is not rounded.\r\nImpactPerUnit * Quantity = Impact @ Quantity"
          format: double
          type: number
        isForced:
          description: >-
            Signifies that the discount is forced and not applied via best
            match.
          type: boolean
        normalizedImpact:
          format: double
          type: number
        quantity:
          description: Quantity of items from the line item that the discount applies to.
          format: int32
          type: integer
        shippingMethodCode:
          description: Unique identifier of the shipping method discount.
          nullable: true
          type: string
      type: object
    PricingRuntimeDiscountCondition:
      properties:
        couponCode:
          description: >-
            ShippingMethodCode of the coupon associated with the discount (if a
            coupon code is required). The merchant can supply the code or the
            system can generate it.
          nullable: true
          type: string
        customerSegmentIds:
          description: List of customer groups for which the discount applies
          items:
            format: int32
            type: integer
          nullable: true
          type: array
        excludedCategoryIds:
          description: >-
            List of categories to discount. When a discount applies to a
            category, all products in the category are discounted.
          items:
            format: int32
            type: integer
          nullable: true
          type: array
        excludedProductCodes:
          description: List of products that are eligible for the discount.
          items:
            type: string
          nullable: true
          type: array
        expirationDate:
          description: >-
            Date when the discount expires. Default is null (no expiration
            date).
          format: date-time
          nullable: true
          type: string
        includedCategoryIds:
          description: >-
            List of categories to discount. When a discount applies to a
            category, all products in the category are discounted.
          items:
            format: int32
            type: integer
          nullable: true
          type: array
        includedProductCodes:
          description: List of products that are eligible for the discount.
          items:
            type: string
          nullable: true
          type: array
        maximumOrderAmount:
          description: "If the discount is for products, how many product can you have and still be eligible for the discount.\r\nIf the discount is for an order, what is the max the order can total to be eligible for the discount. For example, you might want to offer a 10% discount on orders under $100."
          format: double
          nullable: true
          type: number
        minDistinctProductsRequired:
          description: >-
            Minimum number of distinct products that must be purchased that are
            also not free.
          format: int32
          nullable: true
          type: integer
        minimumCategorySubtotalBeforeDiscounts:
          description: "Minimum amount that must be purchased in the combined categories defined in \r\nIncludedCategories.  Amount is calculated before discounting."
          format: double
          nullable: true
          type: number
        minimumLifetimeValueAmount:
          description: Minimum lifetime value amount required for this discount to apply
          format: double
          nullable: true
          type: number
        minimumOrderAmount:
          description: "If the discount is for products, how many products must be purchased to be eligible for the discount.\r\nIf the discount is for an order, how much the order must total to be eligible for the discount. For example, you might want to offer a 10% discount on orders over $100."
          format: double
          nullable: true
          type: number
        minimumQuantityProductsRequiredInCategories:
          description: "Minimum quantity of products in the categories specified in IncludedCategories that must be purchased to\r\nqualify for the associated discount.\r\nValid values are null and ints greater than zero"
          format: int32
          nullable: true
          type: integer
        minimumQuantityRequiredProducts:
          description: "Minimum quantity of products in the specified IncludedProducts that must be purchased to\r\nqualify for the associated discount.\r\nDefaults to 0"
          format: int32
          nullable: true
          type: integer
        paymentWorkflows:
          description: "List of payment types that are valid for this discount.\r\nAn empty list signifies all payment types."
          items:
            type: string
          nullable: true
          type: array
        requiresCoupon:
          description: >-
            If true, the shopper needs to enter a coupon code to redeem the
            discount.
          type: boolean
        startDate:
          description: >-
            Date when the discount can goes into effect, in the format
            yyyy-mm-dd.
          format: date-time
          nullable: true
          type: string
      type: object
    PricingRuntimeDiscountTarget:
      properties:
        excludedCategoriesOperator:
          nullable: true
          type: string
        excludedCategoryIds:
          items:
            format: int32
            type: integer
          nullable: true
          type: array
        excludedProductCodes:
          items:
            type: string
          nullable: true
          type: array
        includeAllProducts:
          description: "When IncludeAllProducts is true then IncludedCategories and IncludedProducts are not evaluated and should be \r\nempty.  Only exclusions apply."
          type: boolean
        includedCategoriesOperator:
          nullable: true
          type: string
        includedCategoryIds:
          items:
            format: int32
            type: integer
          nullable: true
          type: array
        includedProductCodes:
          items:
            type: string
          nullable: true
          type: array
        shippingMethods:
          items:
            type: string
          nullable: true
          type: array
        shippingZones:
          items:
            type: string
          nullable: true
          type: array
        type:
          nullable: true
          type: string
      type: object
    ProductAttribute:
      description: Duplicate definition from ProductRuntime
      properties:
        dataType:
          description: >-
            The DataType of the attribute. Valid values for DataType are defined
            in DataTypeTypeConst.
          nullable: true
          type: string
        description:
          description: >-
            Description of the attribute in the language specified by
            LocaleCode.
          nullable: true
          type: string
        inputType:
          description: >-
            The InputType type of the attribute. Valid values for InputType are
            defined in InputTypeConst.
          nullable: true
          type: string
        name:
          description: Name of the attribute in the language specified by LocaleCode.
          nullable: true
          type: string
        valueType:
          description: >-
            The ValueType of the attribute. Valid values for ValueType are
            defined in ValueTypeTypeConst.
          nullable: true
          type: string
      type: object
    PricingRuntimeProductPropertyValue:
      description: Duplicate definition from ProductRuntime
      properties:
        stringValue:
          description: Localized Value in the language of the locale code
          nullable: true
          type: string
        value:
          nullable: true
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: JWT Authorization header using the Bearer scheme.
      scheme: bearer
      type: http

````