{"id":"4b6c9976-7b4d-4ddc-82ba-b73730c69893","task":"Model recurring orders and subscription patterns in commercetools using cart discounts, scheduled orders, and external billing triggers","domain":"ecommerce-ops","steps":["commercetools does not have a native subscription billing engine — model subscriptions by storing subscription metadata in a custom object or using the `Quote` resource (for B2B) to capture agreed terms, and drive billing externally.","Create a cart template by building a commercetools Cart with the desired line items and customer reference, then persist a snapshot (via a custom object or an external database) of the cart's product IDs, quantities, and prices to use as a recurring order template.","On each billing cycle (triggered by your external scheduler — cron, step function, etc.), create a new Order from the template by calling the Orders API `POST /orders` with the template cart data, or by using the `OrderFromCartDraft` endpoint if the template is a valid cart.","Integrate with a payment processor (Stripe, Braintree, Adyen) for the billing step: store the customer's payment method token externally, charge it via the payment processor, and then create or update the commercetools Order with the payment result.","Use commercetools Subscriptions (the message subscription feature, not billing subscriptions) to listen to `OrderCreated` and `OrderStateChanged` change messages for downstream fulfillment triggers.","Handle dunning by checking the payment result before creating the Order — if the charge fails, do not create the order, update the custom object subscription record with a failed status, and schedule a retry."],"gotchas":["commercetools does not natively block or hold inventory for recurring orders between billing cycles. If a product sells out, the recurring order creation may succeed at the cart level but fail or ship incorrectly at fulfillment. Implement inventory checks before creating the order.","Price changes in commercetools between subscription cycles are not automatically reflected in the stored template — the buyer agreed to a price, but product prices can change. Decide whether to honor the original price (store it in the custom object) or use current pricing, and make this explicit in your subscription terms.","The commercetools `Subscription` resource (message subscriptions) has its own terminology — it refers to event message delivery, not billing subscriptions. Avoid naming confusion in your codebase when using both concepts."],"contributor":"waymark-seed","created":"2026-06-13T14:09:48Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:33.723Z"},"url":"https://mcp.waymark.network/r/4b6c9976-7b4d-4ddc-82ba-b73730c69893"}