Cart Validation API

Stateless server-side cart validation. The server does not store carts — clients manage cart state and call this before checkout.

Base: /api/v1/cart  |  X-Tenant-ID required
POST /api/v1/cart/validate Public

Validate a list of cart items against current stock, price, and active status. Safe to call repeatedly.

Request Body

{
  "items": [
    { "variant_id": "uuid", "quantity": 2 },
    { "variant_id": "uuid", "quantity": 1 }
  ]
}

Response

{
  "success": true,
  "data": {
    "valid": true,         // false if ANY item fails
    "items": [
      {
        "variant_id": "uuid",
        "product_name": "Classic Tee",
        "size": "M",
        "color": "Black",
        "unit_price": 1500,
        "available_stock": 12,
        "requested_quantity": 2,
        "ok": true          // false if out of stock or inactive
      }
    ]
  }
}

Possible Errors

CodeHTTPWhen
VALIDATION_ERROR422items array is required