BETA

Associate Carts

Information icon

This feature is part of Composable Commerce for B2B and will be subject to additional terms and pricing.

Associate Carts allow Associates to interact with Carts on behalf of a Business Unit.

Associates can view, create, update, and delete Carts on behalf of a Business Unit. The actions a given Associate is allowed to perform depends on the specific roles and permissions they hold within the Business Unit.

Get Cart in BusinessUnit

The Associate must have the ViewMyCarts or ViewOthersCarts Permission. If a required Permission is missing, an AssociateMissingPermission error is returned.

Get Cart in BusinessUnit by ID

GET
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
view_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

id
String

id of the Cart.

Query parameters:
expand
The parameter can be passed multiple times.
Response:
200Cart
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Get Cart in a BusinessUnit by Key

GET
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
view_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

key
String

key of the Cart.

Query parameters:
expand
The parameter can be passed multiple times.
Response:
200Cart
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Query Carts in BusinessUnit

GET
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts
OAuth 2.0 Scopes:
view_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

Query parameters:
where
The parameter can be passed multiple times.
/^var[.][a-zA-Z0-9]+$/
Any string parameter matching this regular expression

Predicate parameter values.

The parameter can be passed multiple times.
sort
The parameter can be passed multiple times.
expand
The parameter can be passed multiple times.
limit
Int
offset
Int

Number of elements skipped.

withTotal
Boolean

Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.

Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: CartPagedQueryResponsejson
{
"limit" : 20,
"offset" : 0,
"count" : 1,
"total" : 1,
"results" : [ {
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
} ]
}
Clipboard icon

Create Cart in BusinessUnit

The Associate must have the CreateMyCarts or CreateOthersCarts Permission. If a required Permission is missing, an AssociateMissingPermission error is returned.

POST
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts

Creates a Cart in the BusinessUnit referenced by businessUnitKey. As such, the businessUnit field on CartDraft is ignored for this request. Creating a Cart can fail with an InvalidOperation if the referenced ShippingMethod in the CartDraft has a predicate that does not match the Cart.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

Query parameters:
expand
The parameter can be passed multiple times.
Request Body:CartDraftasapplication/json
Response:
201Cartasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"currency" : "EUR"
}
DATA
Clipboard icon
201 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Replicate Cart in BusinessUnit

The Associate must have the CreateMyCarts or CreateOthersCarts Permission. If a required Permission is missing, an AssociateMissingPermission error is returned.

POST
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate

Creates a new Cart by replicating an existing Cart or Order. Can be useful in cases where a customer wants to cancel a recent order to make some changes or reorder a previous order.

The replicated Cart preserves Customer information, Line Items and Custom Line Items, Custom Fields, Discount Codes, and other settings of the Cart or Order. If the Line Items become invalid, for example, due to removed Products or Prices, they are removed from the new Cart. If the Customer switches to another Customer Group, the new Cart is updated with the new value. It has up-to-date Tax Rates, Prices, and Line Item product data and is in Active CartState.

The new Cart does not contain Payments or Deliveries. The State of Line Items and Custom Line Items is reset to initial.

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

Request Body:ReplicaCartDraftasapplication/json
Response:
201Cartasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/replicate -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"reference" : {
"id" : "74dcac8b-0c67-4f37-b693-3acd33e3c457",
"typeId" : "cart"
}
}
DATA
Clipboard icon
201 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Update Cart in BusinessUnit

The Associate must have the UpdateMyCarts or UpdateOthersCarts Permission. If a required Permission is missing, an AssociateMissingPermission error is returned.

Update Cart in BusinessUnit by ID

POST
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

id
String

id of the Cart.

Query parameters:
expand
The parameter can be passed multiple times.
Request Body:
application/json
version
Int

Expected version of the Cart on which the changes apply. If the expected version does not match the actual version, a 409 Conflict is returned.

actions
Array of CartUpdateAction

Update actions to be performed on the Cart.

Response:
200Cartasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "addLineItem",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"variantId" : 1,
"quantity" : 1
} ]
}
DATA
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Update Cart in BusinessUnit by Key

POST
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

key
String

key of the Cart.

Query parameters:
expand
The parameter can be passed multiple times.
Request Body:
application/json
version
Int

Expected version of the Cart on which the changes apply. If the expected version does not match the actual version, a 409 Conflict is returned.

actions
Array of CartUpdateAction

Update actions to be performed on the Cart.

Response:
200Cartasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "addLineItem",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"variantId" : 1,
"quantity" : 1
} ]
}
DATA
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Delete Cart in BusinessUnit

The Associate must have the DeleteMyCarts or DeleteOthersCarts Permission. If a required Permission is missing, an AssociateMissingPermission error is returned.

Delete Cart in BusinessUnit by ID

DELETE
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

id
String

id of the Cart.

Query parameters:
version
Int

Last seen version of the resource.

expand
The parameter can be passed multiple times.
dataErasure
Boolean

Defaults to false. Set to true if you want to erase all related personal data in compliance with GDPR.

Response:
200Cart
Request Example:cURL
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/{id}?version={version} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon

Delete Cart in BusinessUnit by Key

DELETE
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}

If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.

OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

associateId
String

id of the Customer who is acting on behalf of the BusinessUnit.

businessUnitKey
String

key of the BusinessUnit.

key
String

key of the Cart.

Query parameters:
version
Int

Last seen version of the resource.

expand
The parameter can be passed multiple times.
dataErasure
Boolean

Defaults to false. Set to true if you want to erase all related personal data in compliance with GDPR.

Response:
200Cart
Request Example:cURL
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/carts/key={key}?version={version} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Cartjson
{
"type" : "Cart",
"id" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"key" : "test-key",
"version" : 5,
"createdAt" : "2015-09-22T15:36:17.510Z",
"lastModifiedAt" : "2015-09-22T15:41:55.816Z",
"customerId" : "2a3baa00-44fa-4ab8-bec7-933c31e18dcf",
"businessUnit" : {
"key" : "bu-345-france",
"typeId" : "business-unit"
},
"lineItems" : [ {
"id" : "b925a817-d5ad-48bb-a407-29ad8e0649b5",
"productId" : "9f10dcfb-5cc9-4a18-843a-c07f7e22d01f",
"name" : {
"en" : "SAPPHIRE"
},
"productType" : {
"typeId" : "product-type",
"id" : "2543e1d8-4915-4f72-a3c9-1df9b1b0082d",
"version" : 8
},
"productSlug" : {
"en" : "sapphire1421832124423"
},
"variant" : {
"id" : 1,
"sku" : "sku_SAPPHIRE_variant1_1421832124423",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
} ],
"images" : [ {
"url" : "https://www.commercetools.com/cli/data/252542005_1.jpg",
"dimensions" : {
"w" : 1400,
"h" : 1400
}
} ],
"attributes" : [ ],
"assets" : [ ]
},
"price" : {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 2800
},
"id" : "8da659ef-9e54-447d-9c36-84912db1848f"
},
"quantity" : 2,
"discountedPricePerQuantity" : [ ],
"state" : [ {
"quantity" : 2,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"store" : {
"typeId" : "store",
"key" : "test-key"
},
"cartState" : "Active",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 5600
},
"customLineItems" : [ ],
"discountCodes" : [ ],
"inventoryMode" : "None",
"taxMode" : "Platform",
"taxRoundingMode" : "HalfEven",
"taxCalculationMode" : "LineItemLevel",
"refusedGifts" : [ ],
"totalLineItemQuantity" : 2,
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single",
"itemShippingAddresses" : [ ],
"directDiscounts" : [ ]
}
Clipboard icon