An agent is a retry machine pointed at your API. It retries on a timeout, on a rate limit, when its own loop restarts. If your checkout isn't idempotent, that retry is a second order and a second charge on a real person's card.
These are runnable examples for OrderCore — the commerce
API and MCP server for AI agents: catalog, prices, inventory, and idempotent
checkout. Every one of them deliberately retries the payment call and exits 0
only if one order came back.
No API key. No signup. No dependencies to install.
git clone https://github.com/RulezZzOr/ordercore-examples.git
cd ordercore-examples/agent-commerce-demo
node run.mjs # Node 18+
python3 run.py # or Python 3.8+→ complete_checkout_session({"session_id":"cs_sku_espresso"})
{"order_id":"order_1","status":"confirmed"}
→ complete_checkout_session({"session_id":"cs_sku_espresso"}) ← the retry
{"order_id":"order_1","status":"confirmed"} ← same order
✅ 2 completion calls -> 1 order. Idempotency held.
Exit code 0 means the retried checkout returned the same order, not two.
claude mcp add ordercore --env ORDERCORE_API_KEY=oc_live_xxx -- /path/to/ordercore-mcpBinaries for macOS/Linux/Windows: ordercore.ai/downloads ·
Claude Desktop / Cursor config: mcp/
| Example | What it shows |
|---|---|
agent-commerce-demo/ |
The core flow: create a checkout session → complete it → retry → same order. Node + Python. |
sandbox-quickstart/ |
First real, authenticated call with no signup, no key — issue a read-only sandbox key from POST /bootstrap/sandbox-key, then read the live catalog. Run node run.mjs --live. |
catalog-read/ |
The "shop" phase: search_products, get_product, get_prices, get_inventory as plain REST GETs. |
idempotent-orders/ |
Idempotency-Key on POST /v1/orders: 201 new / 200 replay / 409 conflict. |
claude-checkout-agent/ |
Full Claude agentic loop — tool_use → execute → tool_result; the agent retries checkout and gets the same order. Offline scripted-model mode or live with ANTHROPIC_API_KEY. |
openai-checkout-agent/ |
GPT function-calling loop over the same tools (raw fetch, zero deps). Offline or live with OPENAI_API_KEY. |
langchain-checkout-agent/ |
LangChain @tool functions + agent loop; drop TOOLS into any LangChain/LangGraph agent. |
vercel-ai-checkout-agent/ |
Vercel AI SDK tool() definitions + one generateText call; offline via MockLanguageModelV3. |
mcp/ |
Register the ordercore-mcp server with Claude Code, Claude Desktop, or Cursor. |
- Get an API key at ordercore.ai/bootstrap — two fields, no payment.
- Re-run any example with
ORDERCORE_API_KEY=oc_live_xxx. - Wire the same tools into your agent:
- MCP:
mcp/— one command for Claude Code - OpenAPI 3.1:
ordercore.ai/openapi.yaml— import into GPT Actions, Postman, or a codegen - Ready-made tool schemas for OpenAI / Claude / Gemini / DeepSeek / Grok:
api.ordercore.ai/direct-ai/tooling
- MCP:
Official, dependency-free clients that make idempotency the default and retry
safely. Each has a one-line sandbox() that issues a read-only key for you —
no signup:
| SDK | Install | First call, no signup |
|---|---|---|
sdk/js — Node 18+ |
npm i @ordercore/sdk |
const oc = await OrderCore.sandbox(); |
sdk/python — Python 3.8+ |
copy sdk/python/ordercore/ (stdlib only; PyPI package coming) |
oc = OrderCore.sandbox() |
Full read/write keys (for checkout) at ordercore.ai/bootstrap.
Agents retry. Networks fail mid-checkout. Without idempotency, a retried
complete_checkout charges twice; with OrderCore the same completion call always
returns the same order, and the same Idempotency-Key with a different payload
returns 409 instead of silently creating a second order.
Full write-up.
- Docs: https://ordercore.ai/docs
- Browser demo (no signup): https://ordercore.ai/agent-commerce-demo
- MCP guide: https://ordercore.ai/what-is-an-mcp-commerce-server
- OrderCore vs Stripe Agent Toolkit: https://ordercore.ai/ordercore-vs-stripe-agent-toolkit
MIT — see LICENSE. (The OrderCore service and backend are proprietary; these examples and docs are free to copy into your own agent.)