Skip to content

About

Give your AI agent a retry-safe checkout tool in 5 minutes. Runnable examples for OrderCore — the commerce API + MCP server for AI agents. Offline, no signup.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Give your AI agent a checkout tool — retries never double-charge

examples run offline no signup MCP server OpenAPI 3.1 license MIT

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.

Try it in 30 seconds

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.

Wire it into your agent in one command

claude mcp add ordercore --env ORDERCORE_API_KEY=oc_live_xxx -- /path/to/ordercore-mcp

Binaries for macOS/Linux/Windows: ordercore.ai/downloads · Claude Desktop / Cursor config: mcp/

What's here

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.

Go live

  1. Get an API key at ordercore.ai/bootstrap — two fields, no payment.
  2. Re-run any example with ORDERCORE_API_KEY=oc_live_xxx.
  3. Wire the same tools into your agent:

SDKs

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.

Why idempotency matters for agents

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.

Links

License

MIT — see LICENSE. (The OrderCore service and backend are proprietary; these examples and docs are free to copy into your own agent.)

About

Give your AI agent a retry-safe checkout tool in 5 minutes. Runnable examples for OrderCore — the commerce API + MCP server for AI agents. Offline, no signup.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages