Skip to main content

Carts & Orders

Kadaikodi's cart and order model is headless and durable. The same cart survives device switches, and the order is the single source of truth for every transaction.

Cart

A cart is a workspace-scoped, actor-scoped working set of offerings with quantities, customizations, and computed totals. It is:

  • Durable — survives logouts, device switches, and app restarts
  • Headless — driven entirely through GraphQL; works from any client
  • Computed — subtotal, tax, delivery fee, discount, and total are server-calculated
query {
myCart {
id
items {
offeringId
quantity
customizations
unitPrice
lineTotal
}
subtotal
tax
deliveryFee
discount
total
}
}

Order lifecycle

Orders advance through a status machine:

PENDING → PLACED → CONFIRMED → PREPARING → READY → OUT_FOR_DELIVERY → DELIVERED → COMPLETED

Each transition records a timeline entry with actor, timestamp, and notes.

Payment status

Payment status is independent of fulfillment status:

StatusMeaning
PENDINGAwaiting payment
PAIDSuccessfully charged
FAILEDPayment declined
REFUNDEDFull refund issued
PARTIALLY_REFUNDEDPartial refund issued

GraphQL

mutation {
placeOrder(input: {
items: [{ offeringId: "off_123", quantity: 2, customizations: ["No sugar"] }]
fulfillmentType: DELIVERY
deliveryAddress: "..."
paymentMethod: UPI
}) {
id
orderNumber
status
paymentStatus
subtotal
tax
deliveryFee
discount
total
}
}

mutation {
updateOrderStatus(id: "ord_789", status: PREPARING) {
id
orderNumber
status
paymentStatus
}
}

Next steps