Skip to main content

Bulk Add Tax Items to Cart

POST 

/v2/carts/:cartID/taxes

note

A cart item can only have a maximum of five tax items.

Errors

422 Unprocessable Entity

In this example, when options.add_all_or_nothing is set to true and if one of cart items is not found or or has reached its maximum tax item limit, the following error response is returned:

{
"status": 422,
"title": "Add all or nothing.",
"detail": "Add all or nothing set to (true). Could not bulk add tax items to cart."
}

In this example, if you add more than five tax items to the same cart item, the following error response is returned:

{
"status": 422,
"title": "Tax item not added to cart item.",
"detail": "Cannot exceed tax item limit of (5) on cart item.",
"meta": {
"id": "f88e6370-cb35-40b2-a998-c759f31dec0a"
}
}

404

In this example, if there is a mismatch between cart_item/custom_item and the relationships.item.data.type specified in the bulk add tax item, the following error response is returned:

{
"data": [],
"errors": [
{
"status": 404,
"title": "Tax item not added to cart item.",
"detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
"meta": {
"id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
}
},
{
"status": 404,
"title": "Tax item not added to cart item.",
"detail": "Mismatch between bulk tax item type(cart_item) and cart item type(custom_item).",
"meta": {
"id": "56aab5d1-1dd4-45ed-88ed-4d0cc396b62d"
}
}
]
}

Request

Path Parameters

    cartID stringrequired

    The unique identifier of the cart.

Body

    data object[]
  • Array [
  • code string

    A unique tax code in this jurisdiction.

    jurisdiction string

    The relevant tax jurisdiction.

    name string

    The name of the tax item.

    rate numberrequired

    The tax rate represented as a decimal (12.5% -> 0.125).

    type stringrequired

    The type of object being returned. Use tax_item.

    relationships object
    order object
    data object
    type string

    This specifies the type of item.

    id uuid

    This specifies the ID of the cart_item or custom_item in the cart.

  • ]
  • options object
    add_all_or_nothing boolean

    When true, if an error occurs for any item, no items are added to the cart. When false, valid items are added to the cart and the items with errors are reported in the response. Default is false.

Responses

Response Headers
    Schema
      data object[]
    • Array [
    • code string

      A unique tax code in this jurisdiction.

      jurisdiction string

      The relevant tax jurisdiction.

      name string

      The name of the tax item.

      rate numberrequired

      The tax rate represented as a decimal (12.5% -> 0.125).

      type stringrequired

      The type of object being returned. Use tax_item.

      id uuidrequired

      The unique identifier for this tax item.

      relationships object
      order object
      data object
      type string

      This specifies the type of item.

      id uuid

      This specifies the ID of the cart_item or custom_item in the cart.

    • ]
    • options object
      add_all_or_nothing boolean

      When true, if an error occurs for any item, no items are added to the cart. When false, valid items are added to the cart and the items with errors are reported in the response. Default is false.

    Loading...