My Orders
The My Orders API creates and provides access to Orders scoped to a specific Customer. The endpoints require an access token from the password flow or anonymous session flow.
The My Orders API intentionally provides no write access on an Order. This provides extra security in scenarios when a mobile or browser application communicates directly with the Composable Commerce API on behalf of a customer. For example, the mobile application cannot set the order number. If you need to modify a protected field available on the full Order resource, do it from a trusted, server-side application. Use an API Extension to make the modification during the API call.
Orders cannot be changed via this API once created, and paymentState and orderNumber cannot be set.
Representations
Find below the representations for the request payloads that are specific for My Orders, the response representations are equal to the ones for the general Orders documented there.
MyOrderFromCartDraft
MyOrderFromQuoteDraft BETA
Get My Order
Returns an Order for a given id. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Order exists for the given
id. - If the Order exists but does not have either a
customerIdthat matches the customer:{id} scope, or ananonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/me/orders/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}
Get My Order in Store
Returns an Order for a given id in a Store. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Order exists in the Store for the given
id. - If the Order exists but does not have a
storespecified, or thestorefield references a different Store. - If the Order exists but does not have a
customerIdthat matches the customer:{id} scope, oranonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}manage_my_orders:{projectKey}:{storeKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/orders/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}
Query My Orders
Returns all Orders that match a given Query Predicate.
A ResourceNotFound error is returned in the following scenarios:
- If no Orders exist for a given Query Predicate.
- If the Order exists but does not have a
customerIdthat matches the customer:{id} scope, oranonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}]}
Query My Orders in Store
Returns all Orders in a Store that match a given Query Predicate and contain either a customerId that matches the customer_id:{id} scope, or an anonymousId that matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}manage_my_orders:{projectKey}:{storeKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}]}
Check if My Order exists
Check if My Order exists by ID
Checks if an Order exists for a given id. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Order exists for the given
id. - If the Order exists but does not have either a
customerIdthat matches the customer:{id} scope, or ananonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/me/orders/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if My Order exists by Query Predicate
Checks if an Order exists for a given Query Predicate. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Order exists that matches the Query Predicate.
- If one or more Orders exist but don't have either a
customerIdthat matches the customer:{id} scope, or ananonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}customer:{customerId}anonymous_id:{anonymousId}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if My Order exists in Store
Check if My Order exists in Store by ID
Checks if an Order exists for a given id in a Store. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Order exists in the Store for the given
id. - If the Order exists but does not have a
storespecified, or thestorefield references a different Store. - If the Order exists but does not have a
customerIdthat matches the customer:{id} scope, oranonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}manage_my_orders:{projectKey}:{storeKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/orders/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if My Order exists in Store by Query Predicate
Checks if an Order exists for a given Query Predicate in a Store. Returns a 200 OK status if successful.
A ResourceNotFound error is returned in the following scenarios:
- If no Orders exist in the Store that match the Query Predicate.
- If an Order matches the Query Predicate, but no
storeis specified, or thestorefield references a different Store. - If an Order matches the Query Predicate, but does not have a
customerIdthat matches the customer:{id} scope, or ananonymousIdthat matches the anonymous_id:{id} scope.
manage_my_orders:{projectKey}manage_my_orders:{projectKey}:{storeKey}customer:{customerId}anonymous_id:{anonymousId}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Create My Order
Create My Order from My Cart
Creates an Order from a Cart for the Customer or anonymous user. The customerId or anonymousId field on the Order is automatically set based on the customer:{id} or anonymous_id:{id} scope.
The Cart must have a shipping address set for taxes to be calculated. When creating B2B Orders, the Customer must have the CreateMyOrdersFromMyCarts Permission.
Creating an Order produces the OrderCreated Message.
If the Cart's customerId does not match the customer:{id} scope, or the anonymousId does not match the anonymous_id:{id} scope, a ResourceNotFound error is returned.
If a server-side problem occurs, indicated by a 500 Internal Server Error HTTP response, the Order creation may still successfully complete after the error is returned. If you receive this error, you should verify the status of the Order by querying a unique identifier supplied during the creation request, such as the Order number.
Specific Error Codes:
manage_my_orders:{projectKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca","version" : 10}DATA
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}
Create My Order from My Quote BETA
Creates an Order from a Quote. To create B2B Orders, the Customer must have the CreateMyOrdersFromMyQuotes Permission.
The referenced Quote must have the Pending state and must be valid (not past the validTo date); otherwise, an InvalidOperation error is returned.
Produces the OrderCreated Message.
Specific Error Codes:
manage_quotes:{projectKey}customer_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/me/orders/quotes -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "40d04a85-34d3-4769-a1b6-ecd00db2a587","version" : 1,"quoteStateToAccepted" : true}DATA
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}
Create My Order in Store from My Cart
Creates an Order in a Store from a Cart for the Customer or anonymous user. The customerId or anonymousId field on the Order is automatically set based on the customer:{id} or anonymous_id:{id} scope.
The Cart must have a shipping address set for taxes to be calculated. When creating B2B Orders, the Customer must have the CreateMyOrdersFromMyCarts Permission.
If the Cart's customerId does not match the customer:{id} scope, or the anonymousId does not match the anonymous_id:{id} scope, a ResourceNotFound error is returned.
Creating an Order produces the OrderCreated Message.
Specific Error Codes:
manage_my_orders:{projectKey}manage_my_orders:{projectKey}:{storeKey}customer_id:{id}anonymous_id:{id}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/orders -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "7c2e2694-aefe-43d7-888e-6a99514caaca","version" : 10}DATA
{"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},"taxPortions": [{"rate": 0.1,"amount": {"type": "centPrecision","currencyCode": "EUR","centAmount": 634,"fractionDigits": 2},"name": "Bla"}]},"perMethodTaxRate": [],"taxedPricePortions": []}],"customLineItems": [],"discountCodes": [],"origin": "Customer","shipping": [],"shippingMode": "Single"}