Class ByProjectKeyMeOrdersPost

All Implemented Interfaces:
ConflictingTrait<ByProjectKeyMeOrdersPost>, Deprecatable201Trait<ByProjectKeyMeOrdersPost>, ErrorableTrait<ByProjectKeyMeOrdersPost>, ExpandableTrait<ByProjectKeyMeOrdersPost>, ClientRequestCommand<Order>, CreateHttpRequestCommand, HttpRequestCommand<Order>, RequestCommand<Order>

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:

  • AssociateMissingPermission
  • DiscountCodeNonApplicable
  • InvalidItemShippingDetails
  • OutOfStock
  • PriceChanged
  • ShippingMethodDoesNotMatchCart
  • MatchingPriceNotFound
  • MissingTaxRateForCountry


   CompletableFuture<ApiHttpResponse<com.commercetools.api.models.order.Order>> result = apiRoot
            .withProjectKey("{projectKey}")
            .me()
            .orders()
            .post(null)
            .execute()