Authenticate with commercetools using the client credentials OAuth flow to obtain an access token scoped to the manage_orders scope
Create a cart by posting to the carts endpoint with the required currency, customer email or customerId, and any desired shipping address
Add line items to the cart using the addLineItem update action, specifying the productId and variantId; if the line items need custom fields, first ensure a custom type is assigned to the cart or line item using the setLineItemCustomType update action
Set custom field values on the line items using the setLineItemCustomField update action with the field name and value matching the type definition
Create an order from the cart by posting to the orders endpoint with the cartId and the cart version; handle the version conflict error by re-fetching the cart version before retrying
Verify the resulting order has the correct state, line items, and custom fields by fetching the order by ID
Known gotchas
commercetools uses optimistic concurrency via a version field on all resources; every update action must include the current version number, and any concurrent modification will return a 409 conflict that requires a re-fetch and retry
Custom fields on line items require a custom type to be defined and assigned before the field values can be set; attempting to set a custom field on a line item without a type assigned returns a validation error
Creating an order from a cart consumes the cart; the cart cannot be reused after order creation, so any retry logic must create a new cart rather than retrying the order creation with the old cart ID
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp