Getting started
This page takes you from a fresh clone to a running orchestrator that answers agent requests, in about ten minutes. Most of that is the first compile. Nothing here needs a database, Docker or any backend of your own: development mode runs against built-in mock providers.
What you need
- Rust 1.94 or newer (
rustc --versionto check). gitandcurl.
1. Clone the repository
git clone https://github.com/AncientiCe/commerce-orchestrator-api.git
cd commerce-orchestrator-api
2. Watch a full checkout run
The happy_path example drives one complete purchase through the orchestrator: create a cart, add an item, reprice, compute tax, check geography, authorize and capture payment, and generate a receipt. Every backend is a mock, so there is nothing to configure.
cargo run -p happy_path
The first build compiles the whole workspace and takes a few minutes. The run itself ends with a line like this:
INFO happy_path: Checkout completed cart_id=… transaction_id=txn_… status=Completed
status=Completed means every step of the checkout flow passed.
3. Start the server
cargo run -p orchestrator-http --bin orchestrator-server
With no configuration file and no ENV=production, the server starts in development mode on 0.0.0.0:8080, with mock providers, in-memory storage and a demo catalog of three items: demo-tee (25.00), demo-mug (12.00) and demo-cap (18.00). Leave it running and open a second terminal.
Check that it is up:
curl -s localhost:8080/health/live
If that prints nothing, another program may be listening on port 8080 too. Use 127.0.0.1:8080 in place of localhost:8080 in the commands below.
4. Shop the way an agent would
The commands below go from discovery to a paid order. Set two shell variables first to keep them short:
API=localhost:8080/api/v1; JSON='content-type: application/json'
Discover the merchant. An agent’s first request is the UCP business profile. It lists the supported UCP versions, the services and their endpoints, the signing keys and the payment handlers. A2A agents read /.well-known/agent-card.json instead.
curl -s localhost:8080/.well-known/ucp
Find a product.
curl -s -X POST $API/ucp/catalog/search -H "$JSON" -d '{"query":"tee"}'
The response lists demo-tee with "price_minor":2500. Money is always an integer in minor units, so 2500 is 25.00 USD.
Create a cart. Cart operations all go through one command endpoint:
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"create_cart","merchant_id":"demo","currency":"USD"},"cart_id":null}'
The response is the cart, at "version":1. Copy its cart_id and use it in place of <cart_id> from here on.
Add two T-shirts.
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"add_item","item_id":"demo-tee","quantity":2},"cart_id":"<cart_id>"}'
Adding the item priced the line, computed tax and checked geography against the mock providers. The cart is now at "version":2 with "subtotal_minor":5000, "tax_minor":500 and "total_minor":5500.
Start checkout. This locks the cart at the version you saw, so it cannot change under you:
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"start_checkout","cart_id":"<cart_id>","cart_version":2},"cart_id":"<cart_id>"}'
The cart moves to "status":"checkout_ready" at "version":3.
Pay. The payment intent states the amount the agent expects to pay, and it must equal the cart total:
curl -s -X POST $API/checkout/execute -H "$JSON" \
-d '{"tenant_id":"dev","merchant_id":"demo","cart_id":"<cart_id>","cart_version":3,"currency":"USD",
"payment_intent":{"amount_minor":5500,"token_or_reference":"tok_demo"},"idempotency_key":"demo-1"}'
The response is the transaction: "status":"completed", "payment_state":"captured", a receipt and an order_id.
Two things to try, both described in the architecture page:
- Pay the wrong amount. Send
"amount_minor":5400with a newidempotency_keyand checkout is refused with"code":"AMOUNT_MISMATCH"before any payment call. - Send the same request again. The same
idempotency_keyreturns the originaltransaction_idinstead of charging twice.
5. Try the other protocols
List the MCP tools. The same operations are available to MCP clients as tools:
curl -s -X POST localhost:8080/api/v1/mcp/message \
-H 'content-type: application/json' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Get the REST contract. The full REST API is published as OpenAPI 3.1:
curl -s localhost:8080/api/v1/openapi.json
6. Run the tests
cargo test --workspace
This runs the unit, integration and protocol conformance suites, all against mocks. Tests that need PostgreSQL skip themselves unless DATABASE_URL is set.
Where to go next
| You want to… | Read |
|---|---|
| Understand how it works inside | Architecture |
| Connect your catalog, pricing, tax, geo, payment and receipt services | Plug and deploy and the provider API |
| Call every endpoint, with request and response shapes | Consumption guide |
| Connect an MCP client | MCP binding |
| Check what each protocol covers | Conformance matrix |
| Decide whether it fits your case | FAQ |