Shopping Cart & Checkout
5 API calls in this section.
Get Cart
/storefront/stores/:store_id/cartRetrieves the authenticated user's shopping cart for the store (market), with items, pricing, and totals.
1curl --request GET "$ONDI_BASE_URL/storefront/stores/:store_id/cart" \2 --header "Authorization: Bearer {{access_token}}"Path parameters
store_idRequired{{store_id}}
Headers
AuthorizationOptionalBearer {{access_token}}
JWT (required). Cart is keyed by authenticated user.
Responses
1{2 "success": true,3 "data": {4 "cart": {5 "id": "cart-uuid-123",6 "market_id": "{{store_id}}",7 "enriched_items": [8 {9 "variant_id": "variant-uuid-1",10 "quantity": 2,11 "variant_slug": "iphone-15-pro-space-gray-256gb",12 "product_slug": "iphone-15-pro",13 "has_variant": true,14 "variant": {15 "id": "variant-uuid-1",16 "slug": "iphone-15-pro-space-gray-256gb",17 "name": {18 "en": "iPhone 15 Pro - 256GB"19 },20 "price": 999.99,21 "images": [22 "https://example.com/iphone15-pro-1.jpg"23 ],24 "stock_quantity": 25,25 "attributes": {26 "color": "Space Gray",27 "storage": "256GB"28 },29 "product": {30 "id": "product-uuid-1",31 "name": {32 "en": "iPhone 15 Pro"33 },34 "market_id": "market-uuid",35 "slug": "iphone-15-pro",36 "has_variant": true37 }38 }39 }40 ],41 "total_items": 2,42 "updated_at": "2023-12-01T15:30:00Z"43 }44 }45}1{2 "success": true,3 "cart": null4}Add to Cart
/storefront/stores/:store_id/cart/itemsAdds a product variant to the authenticated user's shopping cart.
1curl --request POST "$ONDI_BASE_URL/storefront/stores/:store_id/cart/items" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "variant_id": "variant-uuid-123",7 "quantity": 18}'1{2 "variant_id": "variant-uuid-123",3 "quantity": 14}Path parameters
store_idRequired{{store_id}}
Request body fields
variant_idExampleExample field from the request body.
quantityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
JWT (required)
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Item added to cart"4}1{2 "success": false,3 "message": "Insufficient stock available"4}1{2 "success": false,3 "message": "Product not found or not available"4}Update Cart Item
/storefront/stores/:store_id/cart/itemsUpdates the quantity of an item in the shopping cart. To remove an item, set quantity to 0.
1curl --request PUT "$ONDI_BASE_URL/storefront/stores/:store_id/cart/items" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "variant_id": "variant-uuid-123",7 "quantity": 38}'1{2 "variant_id": "variant-uuid-123",3 "quantity": 34}Path parameters
store_idRequired{{store_id}}
Request body fields
variant_idExampleExample field from the request body.
quantityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
JWT (required)
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Cart updated"4}Remove from Cart
/storefront/stores/:store_id/cart/itemsRemoves an item from the cart by setting its quantity to 0.
1curl --request PUT "$ONDI_BASE_URL/storefront/stores/:store_id/cart/items" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "variant_id": "variant-uuid-123",7 "quantity": 08}'1{2 "variant_id": "variant-uuid-123",3 "quantity": 04}Path parameters
store_idRequired{{store_id}}
Request body fields
variant_idExampleExample field from the request body.
quantityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
JWT (required)
Content-TypeOptionalapplication/json
Responses
1{2 "success": true,3 "message": "Cart updated"4}Checkout - Create Order from Cart
/storefront/stores/{{store_id}}/checkoutCreates a pending order from the authenticated user's cart. No request body required. Payment method and shipping address will be handled in a separate payment initiation API.
1curl --request POST "$ONDI_BASE_URL/storefront/stores/{{store_id}}/checkout" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "X-API-Key: {{api_key}}"Path parameters
store_idRequiredVariable used inside the request path.
Headers
AuthorizationOptionalBearer {{access_token}}
X-API-KeyOptional{{api_key}}
Alternative authentication method
Responses
No response example is available for this endpoint yet.