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.
Path parameters
| Parameter | Type | Description |
|---|---|---|
store_idRequired | string | Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
AuthorizationRequired | string | JWT (required). Cart is keyed by authenticated user. Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/storefront/stores/${STORE_ID}/cart" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
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}Add to Cart
/storefront/stores/:store_id/cart/itemsAdds a product variant to the authenticated user's shopping cart.
Path parameters
| Parameter | Type | Description |
|---|---|---|
store_idRequired | string | Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
AuthorizationRequired | string | JWT (required) Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
variant_id | string | — |
quantity | number | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/storefront/stores/${STORE_ID}/cart/items" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "variant_id": "variant-uuid-123",6 "quantity": 17}'Response examples
1{2 "success": true,3 "message": "Item added to cart"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.
Path parameters
| Parameter | Type | Description |
|---|---|---|
store_idRequired | string | Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
AuthorizationRequired | string | JWT (required) Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
variant_id | string | — |
quantity | number | — |
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/storefront/stores/${STORE_ID}/cart/items" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "variant_id": "variant-uuid-123",6 "quantity": 37}'Response examples
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.
Path parameters
| Parameter | Type | Description |
|---|---|---|
store_idRequired | string | Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
AuthorizationRequired | string | JWT (required) Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
variant_id | string | — |
quantity | number | — |
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/storefront/stores/${STORE_ID}/cart/items" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "variant_id": "variant-uuid-123",6 "quantity": 07}'Response examples
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.
Path parameters
| Parameter | Type | Description |
|---|---|---|
store_idRequired | string | Variable used inside the request path. |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
X-API-Key | string | Alternative authentication method Example: |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/storefront/stores/${STORE_ID}/checkout" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "X-API-Key: ${ONDI_TENANT_API_KEY}"Response examples
No saved response example. Use Try it to inspect a staging response.