Agent Cart API

The Cart API allows agents to manage their cart within a session.
All cart operations require a valid {domain} and a session_id obtained from the Session API.


Endpoints Overview

MethodEndpointDescription
GET/{domain}/agent/cart/getRetrieve the current items in the cart.
POST/{domain}/agent/cart/addAdd a new product or increase quantity.
POST/{domain}/agent/cart/deleteRemove a product from the cart.

Authentication & Requirements

  • Domain Validation – All routes are domain-prefixed: /{domain}/agent/cart/...
  • Session Key – A valid session_id is required to identify the cart owner.
  • Agent Authorization – Agents must authenticate via Session API.

1. Retrieve Cart Items

Retrieve all items in the agent’s cart.

Example request: Get cart contents

curl "https://api.waltacheckout.com/{domain}/agent/cart/get?session_id={session_key}"

Example Response

[
  {
    "id": "9f0d71a0-5e32-4d40-9b20-91bcd23a8d11",
    "domain": "store-alpha",
    "session_id": "sess_12345",
    "product_id": "prod_6789",
    "quantity": 2,
    "created_at": "2025-08-03T10:20:30Z",
    "updated_at": "2025-08-03T11:15:00Z"
  }
]

2. Add Product to Cart

Adds a product to the cart or updates the quantity if it already exists.

curl -X POST "https://api.waltacheckout.com/{domain}/agent/cart/add" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_12345",
    "product_id": "prod_6789",
    "quantity": 1
  }'

Example Response

{
  "id": "9f0d71a0-5e32-4d40-9b20-91bcd23a8d11",
  "domain": "store-alpha",
  "session_id": "sess_12345",
  "product_id": "prod_6789",
  "quantity": 3,
  "created_at": "2025-08-03T10:20:30Z",
  "updated_at": "2025-08-03T11:20:00Z"
}

3. Delete Product from Cart

Removes a product from the cart.

curl -X POST "https://api.waltacheckout.com/{domain}/agent/cart/delete" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "sess_12345",
    "product_id": "prod_6789"
  }'

Example Response

{ "message": "Item deleted from cart" }

Features

  • Supports incremental updates (adding to existing quantity).
  • Actions are session-scoped, ensuring cart integrity per agent session.
  • Domain validation prevents cross-store cart manipulation.
  • Secure logging and error handling for traceability.

Was this page helpful?