BETA

Associate Orders

Information icon

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

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

Associates can view, create, and update Orders 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 Order in BusinessUnit

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

Get Order in BusinessUnit by ID

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

If the Order 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 Order.

Query parameters:
expand
The parameter can be passed multiple times.
Response:
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon

Get Order in BusinessUnit by OrderNumber

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

If the Order 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.

orderNumber
String

orderNumber of the Order.

Query parameters:
expand
The parameter can be passed multiple times.
Response:
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/order-number={orderNumber} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon

Query Orders in BusinessUnit

GET
https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders
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.

Response:
200OrderPagedQueryResponse
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Clipboard icon
200 Response Example: OrderPagedQueryResponsejson
{
"limit" : 20,
"offset" : 0,
"count" : 1,
"total" : 1,
"results" : [ {
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
} ]
}
Clipboard icon

Create Order in BusinessUnit

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

Create Order from Cart in BusinessUnit

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

Creates an Order from a Cart in a BusinessUnit. The Cart must have a shipping address set before creating an Order. Creating an Order fails with an InvalidOperation if the Cart does not reference the same BusinessUnit as the businessUnitKey path parameter.

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:
application/json
version
Int

Expected version of the Cart from which the Order is created. If the expected version does not match the actual version, a 409 Conflict error will be returned.

ResourceIdentifier of the Cart from which the Order is created.

orderNumber
String

String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed. For easier use on Get, Update and Delete actions we suggest assigning order numbers that match the regular expression [a-z0-9_-]{2,36}.

purchaseOrderNumber
String

Identifier for a purchase order, usually in a B2B context. The Purchase Order Number is typically entered by the Buyer and can also be used with Quotes.

paymentState

Payment state for the Order.

shipmentState

Shipment state for the Order.

orderState

Order will be created with Open status by default.

Reference to a State indicating the Order's state.

custom

Custom Fields for the Order. The Custom Field type must match the type of the Custom Fields in the referenced Cart. If specified, the Custom Fields are merged with the Custom Fields on the referenced Cart and added to the Order. If empty, the Custom Fields on the referenced Cart are added to the Order automatically.

Response:
201Orderasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca",
"version" : 10,
"orderNumber" : "201612010001"
}
DATA
Clipboard icon
201 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon

Create Order from Quote in BusinessUnit

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

Creates an Order from a Quote in a BusinessUnit. Creating an Order fails with an InvalidOperation if the Quote does not reference the same BusinessUnit as the businessUnitKey path parameter.

OAuth 2.0 Scopes:
manage_quotes:{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:
application/json
version
Int

version of the Quote from which an Order is created.

ResourceIdentifier of the Quote from which this Order is created. If the Quote has QuoteState in Accepted, Declined or Withdrawn then the order creation will fail. The creation will also fail if the Quote has expired (validTo check).

quoteStateToAccepted
Boolean

If true, the quoteState of the referenced Quote will be set to Accepted.

Default: false
orderNumber
String

String that uniquely identifies an order. It can be used to create more human-readable (in contrast to ID) identifier for the order. It should be unique across a project. Once it's set it cannot be changed. For easier use on Get, Update and Delete actions we suggest assigning order numbers that match the regular expression [a-z0-9_-]{2,36}.

paymentState

Payment state of the Order.

shipmentState

Shipment state of the Order.

orderState

Order will be created with Open status by default.

Reference to a State indicating the Order's state.

Response:
201Orderasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/quotes -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"quote" : {
"id" : "40d04a85-34d3-4769-a1b6-ecd00db2a587",
"typeId" : "quote"
},
"version" : 1
}
DATA
Clipboard icon
201 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon

Update Order in BusinessUnit

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

Update Order in BusinessUnit by ID

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

If the Order 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 Order.

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

Expected version of the Order on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict error will be returned.

actions
Array of OrderUpdateAction

Update actions to be performed on the Order.

Response:
200Orderasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeOrderState",
"orderState" : "Complete"
} ]
}
DATA
Clipboard icon
200 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon

Update Order in BusinessUnit by OrderNumber

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

If the Order 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.

orderNumber
String

orderNumber of the Order.

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

Expected version of the Order on which the changes should be applied. If the expected version does not match the actual version, a 409 Conflict error will be returned.

actions
Array of OrderUpdateAction

Update actions to be performed on the Order.

Response:
200Orderasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/as-associate/{associateId}/in-business-unit/key={businessUnitKey}/orders/order-number={orderNumber} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeOrderState",
"orderState" : "Complete"
} ]
}
DATA
Clipboard icon
200 Response Example: Orderjson
{
"type" : "Order",
"id" : "92f5a867-bf19-47ab-982c-6720a03a3921",
"version" : 1,
"createdAt" : "2017-01-04T19:54:49.797Z",
"lastModifiedAt" : "2017-01-04T19:54:49.797Z",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"orderState" : "Open",
"syncInfo" : [ ],
"returnInfo" : [ ],
"refusedGifts" : [ ],
"taxMode" : "External",
"inventoryMode" : "None",
"taxRoundingMode" : "HalfEven",
"customerId" : "7297c742-d8b0-484b-aadc-1d0ba6769dc9",
"businessUnit" : {
"typeId" : "business-unit",
"key" : "ba-france-123"
},
"lineItems" : [ {
"id" : "7297c742-d8b0-484b-aadc-1d0ba1869dc9",
"productId" : "c5c75935-595a-4cc3-a80e-24e9a9c55094",
"name" : {
"en" : "MyProduct"
},
"productType" : {
"typeId" : "product-type",
"id" : "a5c7e173-9754-4f02-9b18-a600896ae0e1",
"version" : 21
},
"productSlug" : {
"de" : "neues-produkt-slug-1234678",
"en" : "new-product-slug-12345678"
},
"variant" : {
"id" : 1,
"sku" : "some-sku-123",
"prices" : [ {
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124"
} ],
"images" : [ ],
"attributes" : [ {
"name" : "text",
"value" : "attribute-value"
}, {
"name" : "enum",
"value" : {
"key" : "test",
"label" : "test"
}
} ],
"assets" : [ ]
},
"price" : {
"id" : "6d36dc85-6131-495d-9f20-d00f411d4124",
"value" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
}
},
"quantity" : 1,
"discountedPricePerQuantity" : [ ],
"taxRate" : {
"name" : "Bla",
"amount" : 0.1,
"includedInPrice" : false,
"country" : "DE",
"subRates" : [ ]
},
"state" : [ {
"quantity" : 1,
"state" : {
"typeId" : "state",
"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca"
}
} ],
"priceMode" : "Platform",
"lineItemMode" : "Standard",
"totalPrice" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"taxedPrice" : {
"totalNet" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1000
},
"totalGross" : {
"type" : "centPrecision",
"fractionDigits" : 2,
"currencyCode" : "EUR",
"centAmount" : 1100
}
},
"perMethodTaxRate" : [ ],
"taxedPricePortions" : [ ]
} ],
"customLineItems" : [ ],
"discountCodes" : [ ],
"origin" : "Customer",
"shipping" : [ ],
"shippingMode" : "Single"
}
Clipboard icon