{"id":"bd713bdd-c5cd-42a6-89f2-4d4d5e412798","task":"Build a commercetools API Extension to intercept cart updates and enforce custom business rules via an external HTTP endpoint","domain":"commercetools.com","steps":["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"],"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"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/bd713bdd-c5cd-42a6-89f2-4d4d5e412798"}