OpenClaw Integration

OpenClaw turns Sitewai into an Agent-friendly commerce layer.

An agent can discover products, inspect checkout requirements, create draft or pending orders, and hand the buyer a payment URL without touching store credentials or direct card capture.

Supported platforms
Shopify + WooCommerce
Safety rails
Idempotency + rate limits
Checkout mode
Draft-only / pending-only
What OpenClaw exposes
One consistent contract for discovery, validation, and checkout creation.
Discover

Read the per-domain sitemap instead of scraping storefront HTML.

Validate

Use requirements to learn fields, headers, rate limits, and retry policy.

Create

Call checkout.create to receive an invoice or order-pay URL.

Recover safely

Reuse the same Idempotency-Key only when retrying the identical payload.

OpenClaw flow

The agent discovers the store, validates checkout rules, creates a draft or pending order through Sitewai, and returns the payment URL to the buyer.

Step 1

OpenClaw agent

Starts from a merchant domain, reads docs or the skill, and chooses the product and variant.

GET /api/sitewai/shop.example
GET /api/sitewai/shop.example/requirements
POST /api/checkout/create
discover
validate
Step 2

Merchant storefront

Publishes Sitewai discovery tags so the agent can find the right endpoints for the merchant domain.

ai:sitemap
ai:checkout-requirements
Merchant domain context
Step 3

Sitewai OpenClaw layer

Normalizes products, requirements, and checkout creation into one Agent-friendly contract.

/api/sitewai/shop.example
/api/sitewai/shop.example/requirements
/api/checkout/create + Idempotency-Key
create order
return url
Step 4

Shopify or WooCommerce

Sitewai creates a Draft Order on Shopify or a pending order on WooCommerce server-to-server.

Shopify: variantId required
Woo simple: variantId optional
Woo variable: variantId required
Step 5

Buyer payment step

The agent hands the buyer the invoice or order-pay URL. Payment completes on the merchant checkout.

No direct card capture
Draft-only / pending-only
Inventory not reserved by default
Discovery

Use sitemap and storefront hints before building checkout payloads.

Creation

POST checkout.create with a fresh Idempotency-Key for each new intent.

Retries

Retry only transient failures. Never retry validation errors.

OpenClaw keeps the agent flow explicit: discover, validate, create, then return the merchant payment URL.
GET
Discover products
/api/sitewai/shop.example

Per-domain sitemap with normalized products, prices, and checkout hints.

GET
Inspect checkout requirements
/api/sitewai/shop.example/requirements

Machine-readable requirements, headers, retry policy, rate limits, and examples.

POST
Create draft / pending order
/api/checkout/create

Creates a Shopify draft order or WooCommerce pending order and returns an invoice/payment URL.

Recommended agent flow
Follow this order to minimize ambiguity, duplicates, and checkout failures.
  1. 1Read or obtain the merchant domain.
  2. 2Fetch the Sitewai sitemap for that domain.
  3. 3Identify the product and, if applicable, the exact variant.
  4. 4Fetch requirements when you need platform rules, field hints, or retry policy.
  5. 5Build a valid JSON payload for checkout.create.
  6. 6Generate a fresh Idempotency-Key for this intent.
  7. 7POST to /api/checkout/create with JSON and the idempotency header.
  8. 8Return the invoice or payment URL to the user.
  9. 9Do not retry validation errors.
  10. 10Retry only transient failures with exponential backoff.
Platform-specific behavior
Use the same endpoint contract, but select variants differently by platform.

Shopify

variantId is required. Sitewai creates a Draft Order server-to-server and returns invoice_url. Draft orders do not reserve inventory.

WooCommerce

Simple products can omit variantId. Variable products should send variantId. Sitewai creates a pending order and returns the order-pay URL.

Operational rule

If the sitemap exposes per-variant checkout entries, treat variant selection as mandatory even when the platform technically accepts a bare productId.

Exact requests
These examples match the current Sitewai endpoints and expected headers.
sitemap.http
GET /api/sitewai/shop.example
requirements.http
GET /api/sitewai/shop.example/requirements
checkout-create.http
POST /api/checkout/create
Content-Type: application/json
Idempotency-Key: <uuid>

{
  "domain": "shop.example",
  "productId": "123",
  "variantId": "456",
  "qty": 1,
  "customer": {
    "email": "buyer@example.com",
    "name": "Alice Example"
  },
  "sendEmail": true
}
checkout-create.sh
curl -X POST "$BASE/api/checkout/create" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "domain": "shop.example",
    "productId": "123",
    "variantId": "456",
    "qty": 1,
    "customer": {
      "email": "buyer@example.com",
      "name": "Alice Example"
    },
    "sendEmail": true
  }'
Expected responses
Successful create calls return a payment URL; validation and request errors are normalized.
success.json
{
  "ok": true,
  "status": "invoice_sent",
  "id": "ci_abc123",
  "draftId": "do_987",
  "url": "https://shop.example/pay/invoice/abc",
  "emailed": true,
  "stockConfirmed": false,
  "note": "Shopify/Woo pending does not reserve stock",
  "traceId": "req_7x8ab12c",
  "timestamp": "2026-03-17T10:15:30.000Z"
}
error.json
{
  "ok": false,
  "error": "validation_error",
  "code": "variant_required_for_shopify",
  "message": "Variant is required for Shopify",
  "retryable": false,
  "fields": {
    "variantId": "required"
  },
  "traceId": "req_4v1m8a0f",
  "timestamp": "2026-03-17T10:15:30.000Z"
}

Headers to always send

  • Content-Type: application/json
  • Idempotency-Key: <uuid>
Retries, safety, and failure handling
OpenClaw should be conservative: retry only when the platform or network is transient.

Generate a new Idempotency-Key for every new checkout intent. Reuse the same key only if you are repeating the exact same body after a transient failure or uncertain timeout.

Retry on 408, 502, 503, 504, 522, and 524 using exponential backoff starting at 500ms with a maximum of 3 attempts.

Do not retry 400, 401, 403, 404, 409, or 422. Those indicate invalid input, auth/policy problems, or an idempotency mismatch.

Known limitations
These constraints should be explicit in agent messaging and tool instructions.
  • Draft-only / pending-only flow. OpenClaw does not capture payment directly.
  • Inventory is not reserved by default. The returned URL must be completed by the buyer.
  • sendEmail is optional and only succeeds when Sitewai has SMTP configured or a valid public checkout token path is enabled.
  • The public create flow requires Idempotency-Key on every POST.