Cart

Manage the user's active cart. A cart holds items from a single restaurant. Adding items from a different restaurant requires forceClear: true to replace the existing cart.

Get Cart

GET/ret11/api/cart
Auth Required

Include a Bearer token.

ParameterInRequiredDescription
userIdqueryoptionalYour own platform's user ID for the logged-in user

Add to Cart

POST/ret11/api/cart/add
Auth Required

Include a Bearer token.

Request Body

FieldTypeRequiredDescription
providerIdstringrequiredFrom nearby-restaurants
sellerIdstringrequiredFrom nearby-restaurants
locationIdsstring[]requiredProvider location IDs. Example: ["SSL1"]
itemsarrayrequiredAt least one item. See below.
forceClearbooleanoptionalSet true to clear existing cart (from another restaurant) before adding. Default: false
userIdstringoptionalYour own platform's user ID for the logged-in user

items[]

FieldTypeRequiredDescription
itemIdstringrequiredItem ID from menu
locationIdstringrequiredLocation ID. Example: "SSL1"
quantityintegerrequiredPositive integer
typestringrequired"item" or "customization"
pricenumberrequiredItem price (from menu response)
parentItemIdstringoptionalShared ID grouping a base item with its customizations
parentCategoryIdstringoptionalCustomization group ID (e.g., "CG11")
{
  "providerId": "pramaan_provider_1",
  "sellerId": "019b9e8e-baeb-7158-8090-14afa4db5c46",
  "locationIds": ["SSL1"],
  "items": [
    {
      "itemId": "id_1cctu3_9_0",
      "locationId": "SSL1",
      "quantity": 1,
      "type": "item",
      "price": 530
    }
  ],
  "forceClear": false
}

Cart Response (all endpoints)

FieldTypeDescription
idstringCart UUID
userIdstringOwner user ID
providerIdstringRestaurant provider ID
sellerIdstringRestaurant seller ID
restaurantNamestringDisplay name of the restaurant
locationIdsstring[]Provider location IDs
imagestringRestaurant image URL
items[]arrayCart items. Each has itemId, name, shortDesc, locationId, quantity, price, itemType, image, customizations[]
totalAmountnumberSum of all item prices
totalItemsnumberCount of items in cart
availableOffers[]arrayApplicable offers for this cart
{
  "id": "bf722ad0-1234-5678-abcd-ef0123456789",
  "userId": "120123",
  "providerId": "pramaan_provider_1",
  "sellerId": "019b9e8e-baeb-7158-8090-14afa4db5c46",
  "restaurantName": "Pramaan Store 1",
  "locationIds": ["LOC_01"],
  "image": "https://pramaan.ondc.org/beta/preprod/mock/seller/assets/logo/store1.png",
  "items": [
    {
      "itemId": "id_1cctu3_9_0",
      "name": "Double Patty Cheese Burger",
      "shortDesc": "Double Patty Cheese Burger",
      "locationId": "LOC_01",
      "quantity": 1,
      "price": 200,
      "itemType": "item",
      "image": "https://pramaan.ondc.org/assets/burger.jpg",
      "customizations": []
    }
  ],
  "totalAmount": 200,
  "availableOffers": [],
  "totalItems": 1
}
Clear Cart Response

DELETE /ret11/api/cart/clear returns an empty object {}.

Update Item Quantity

PATCH/ret11/api/cart/items/{itemId}
Auth Required

Include a Bearer token.

FieldInRequiredDescription
itemIdpathrequiredThe cart item ID to update
quantitybodyrequiredNew quantity. Use 0 to remove the item.
userIdbodyoptionalYour own platform's user ID for the logged-in user

Remove Item

DELETE/ret11/api/cart/items/{itemId}
Auth Required

Include a Bearer token.

Removes the item and all its customizations from the cart.

Validate Cart

GET/ret11/api/cart/validate
Auth Required

Include a Bearer token.

Validates cart items are still available and prices are current. Call before proceeding to select.

Clear Cart

DELETE/ret11/api/cart/clear
Auth Required

Include a Bearer token.

Removes all items from the cart. Returns an empty cart object.

Cart to Order Flow
  1. Add items to cart via POST /cart/add
  2. Validate cart via GET /cart/validate
  3. Pass cart items to select to start the ONDC transaction