My Orders

The My Orders endpoint creates and provides access to orders scoped to a specific user. The endpoint requires an access token from the password flow or anonymous session flow.

The My Orders endpoint intentionally provides no write access to the fields on an Order. This provides extra security in scenarios when the client application must communicate directly with the commercetools API on behalf of a customer, such as commerce in a mobile application.

Representations

Responses are equal to the responses on the order endpoint, but requests differ. Orders can not be changed via this endpoint once created, and paymentState and orderNumber can not be set.

MyOrderFromCartDraft

  • id - String - Required
    The unique ID of the cart from which an order is created.
  • version - Number - Required

Get Order

Get Order by ID

Endpoint: /{projectKey}/me/orders/{id}
Method: GET
OAuth2 Scopes: manage_my_orders:{projectKey}
Response Representation: Order

Get Order in a Store by ID

Endpoint: /{projectKey}/in-store/key={storeKey}/me/orders/{id}
Method: GET
OAuth2 Scopes: manage_my_orders:{projectKey}, manage_my_orders:{projectKey}:{storeKey}
Response Representation: Order

Returns an order by its ID from a specific Store. The {storeKey} path parameter maps to a Store’s key.

If the order exists in the commercetools project but does not have the store field, or the store field references a different store, this method returns a ResourceNotFound error.

Query Orders

Query Orders

Endpoint: /{projectKey}/me/orders
Method: GET
OAuth2 Scopes: manage_my_orders:{projectKey}
Response Representation: PagedQueryResult with the results array of Order
Query Parameters:

Query Orders in a Store

Endpoint: /{projectKey}/in-store/key={storeKey}/me/orders
Method: GET
OAuth2 Scopes: manage_my_orders:{projectKey}, manage_my_orders:{projectKey}:{storeKey}
Response Representation: PagedQueryResult with the results array of Order
Query Parameters:

Queries orders in a specific Store. The {storeKey} path parameter maps to a Store’s key.

Create Order

Create Order from a Cart

Creates an order from a Cart. The cart must have a shipping address set which is used for the tax calculation.

The cart data is copied to the created order.

Endpoint: /{projectKey}/me/orders
Method: POST
OAuth2 Scopes: manage_my_orders:{projectKey}
Request Representation: MyOrderFromCartDraft
Response Representation: Order

Specific Error Codes:

This method produces the OrderCreated message.

Create Order in a Store from a Cart

Creates an order from a Cart from a specific Store. The {storeKey} path parameter maps to a Store’s key.

When using this endpoint the orders’s store field is always set to the store specified in the path parameter.

The cart data is copied to the created order.

Endpoint: /{projectKey}/in-store/key={storeKey}/me/orders
Method: POST
OAuth2 Scopes: manage_my_orders:{projectKey}, manage_my_orders:{projectKey}:{storeKey}
Request Representation: MyOrderFromCartDraft
Response Representation: Order

Specific Error Codes:

This method produces the OrderCreated message.