Define an Extension resource in commercetools by posting to the extensions endpoint with a trigger specifying the resource type (Cart) and the action (Create or Update), and an HTTP destination pointing to your external service URL
In the external HTTP endpoint, parse the incoming request body which contains the action type and the resource payload; commercetools sends this synchronously and expects a response within the timeout window
Implement the business rule validation logic in the endpoint; if the rule is violated, return a response with an actions array containing setCustomField or addCustomLineItem actions, or return an error response to block the request
Secure the endpoint by validating the Authorization header sent by commercetools, which uses the credentials specified in the Extension destination configuration
Deploy the endpoint behind HTTPS with low latency since the Extension is on the critical path of cart operations; exceeding the commercetools timeout causes the original request to fail
Test the Extension using the commercetools Merchant Center or API by creating and updating carts and verifying that the extension actions are applied and errors are surfaced correctly
Known gotchas
API Extensions are synchronous and block the original request; a slow or unavailable extension endpoint will cause all affected cart operations to fail for buyers, so high availability is essential
The extension endpoint must respond within the commercetools-defined timeout; the exact timeout value is documented and is not configurable per extension, so optimize the endpoint response time aggressively
Returning an error from an extension does not automatically surface a user-friendly message in the storefront; the error body is returned to the API caller, which must then translate it into a customer-facing message
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