Bulk Add Tax Items to Cart
POST/v2/carts/:cartID/taxes
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
The unique identifier of the cart.
- application/json
Body
- Array [
- ]
data object[]
A unique tax code in this jurisdiction.
The relevant tax jurisdiction.
The name of the tax item.
The tax rate represented as a decimal (12.5% -> 0.125).
The type of object being returned. Use tax_item.
relationships object
order object
data object
This specifies the type of item.
This specifies the ID of the cart_item or custom_item in the cart.
options object
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
- 200
- 401
Response Headers
- application/json
- Schema
- Example (from schema)
Schema
- Array [
- ]
data object[]
A unique tax code in this jurisdiction.
The relevant tax jurisdiction.
The name of the tax item.
The tax rate represented as a decimal (12.5% -> 0.125).
The type of object being returned. Use tax_item.
The unique identifier for this tax item.
relationships object
order object
data object
This specifies the type of item.
This specifies the ID of the cart_item or custom_item in the cart.
options object
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.
{
"data": [
{
"code": "string",
"jurisdiction": "string",
"name": "string",
"rate": 0,
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"relationships": {
"order": {
"data": {
"type": "string",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
}
}
}
],
"options": {
"add_all_or_nothing": true
}
}
Unauthorized
- application/json
- Schema
- Example (from schema)
- Example
Schema
[
null
]
{
"errors": {
"status": 401,
"title": "Unauthorized"
}
}