Skip to main content

Shopping Cart & Checkout

5 API calls in this section.

Get Cart​

Storefront & Commerce / Shopping Cart & Checkout
GET/storefront/stores/:store_id/cart

Retrieves the authenticated user's shopping cart for the store (market), with items, pricing, and totals.

Path parameters

ParameterTypeDescription
store_idRequiredstring

Example: {{store_id}}

Headers

ParameterTypeDescription
AuthorizationRequiredstring

JWT (required). Cart is keyed by authenticated user.

Example: Bearer {{access_token}}

Staging
Request
curl
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

200OK
Response body
json
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 & Commerce / Shopping Cart & Checkout
POST/storefront/stores/:store_id/cart/items

Adds a product variant to the authenticated user's shopping cart.

Path parameters

ParameterTypeDescription
store_idRequiredstring

Example: {{store_id}}

Headers

ParameterTypeDescription
AuthorizationRequiredstring

JWT (required)

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
variant_idstring—
quantitynumber—
Staging
Request
curl
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

200OK
Response body
json
1{2  "success": true,3  "message": "Item added to cart"4}

Update Cart Item​

Storefront & Commerce / Shopping Cart & Checkout
PUT/storefront/stores/:store_id/cart/items

Updates the quantity of an item in the shopping cart. To remove an item, set quantity to 0.

Path parameters

ParameterTypeDescription
store_idRequiredstring

Example: {{store_id}}

Headers

ParameterTypeDescription
AuthorizationRequiredstring

JWT (required)

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
variant_idstring—
quantitynumber—
Staging
Request
curl
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

200OK
Response body
json
1{2  "success": true,3  "message": "Cart updated"4}

Remove from Cart​

Storefront & Commerce / Shopping Cart & Checkout
PUT/storefront/stores/:store_id/cart/items

Removes an item from the cart by setting its quantity to 0.

Path parameters

ParameterTypeDescription
store_idRequiredstring

Example: {{store_id}}

Headers

ParameterTypeDescription
AuthorizationRequiredstring

JWT (required)

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
variant_idstring—
quantitynumber—
Staging
Request
curl
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

200OK
Response body
json
1{2  "success": true,3  "message": "Cart updated"4}

Checkout - Create Order from Cart​

Storefront & Commerce / Shopping Cart & Checkout
POST/storefront/stores/{{store_id}}/checkout

Creates 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

ParameterTypeDescription
store_idRequiredstring

Variable used inside the request path.

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

X-API-Keystring

Alternative authentication method

Example: {{api_key}}

Staging
Request
curl
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.