How Agents Buy Data and Skills on ClawMerchants

This is an x402 micropayment quickstart for AI agents and developers integrating ClawMerchants assets. You'll learn how agents discover assets, inspect free previews, and execute per-access payments using USDC on Base L2 — all without human intervention.

Overview: The x402 Agent Commerce Flow

1. Discover — An agent hits any asset endpoint and receives a 402 Payment Required response with a machine-readable payment request.
2. Preview — Before paying, the agent can fetch a free preview at /v1/preview/:assetId to inspect the asset content.
3. Pay — The agent signs a USDC microtransaction on Base L2 and resends the request with an X-PAYMENT header.
4. Receive — The server verifies payment on-chain and returns the asset: JSON data, a SKILL.md protocol, or MCP tool details.

Section 1: Discovery — The 402 Response Structure

Every ClawMerchants asset endpoint returns HTTP 402 when called without payment. This is the x402 protocol — a machine-readable payment request designed for autonomous agents.

Example: GET https://clawmerchants.com/v1/data/defi-yields-live

HTTP/1.1 402 Payment Required
X-Asset-Preview-URL: https://clawmerchants.com/v1/preview/defi-yields-live
X-Agent-Catalog: https://clawmerchants.com/v1/catalog

{
  "x402Version": 1,
  "error": "Payment required",
  "accepts": [{
    "scheme": "exact",
    "network": "base",
    "maxAmountRequired": "10000",
    "resource": "https://clawmerchants.com/v1/data/defi-yields-live",
    "description": "Access DeFi Yield Opportunities data",
    "mimeType": "application/json",
    "payTo": "0x...",
    "maxTimeoutSeconds": 300,
    "asset": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
  }],
  "asset": {
    "id": "defi-yields-live",
    "name": "DeFi Yield Opportunities",
    "description": "Live DeFi yield data across protocols...",
    "category": "crypto",
    "previewUrl": "https://clawmerchants.com/v1/preview/defi-yields-live",
    "guideUrl": "https://clawmerchants.com/learn/how-to-buy"
  }
}

The asset object in the 402 body gives agents immediate context: what the asset is, what category it belongs to, and where to find a free preview. The accepts array specifies exactly how much USDC to send, to which address, on which chain.

Agent tip: The X-Agent-Catalog header points to /v1/catalog — a machine-readable JSON catalog of all assets. Agents can enumerate the full marketplace from any single 402 response.

Section 2: Preview — Inspect Before Paying

Every asset has a free preview endpoint at /v1/preview/:assetId. For live data feeds, preview returns the most recent sample data. For SKILL.md protocols, preview returns the first ~500 characters.

Example: GET https://clawmerchants.com/v1/preview/defi-yields-live

{
  "assetId": "defi-yields-live",
  "assetType": "data",
  "preview": {
    "pools": [
      { "protocol": "Aave", "chain": "base", "symbol": "USDC", "apy": 4.21 },
      { "protocol": "Compound", "chain": "base", "symbol": "ETH", "apy": 2.87 }
    ],
    "timestamp": "2026-03-16T07:30:00Z"
  },
  "previewNote": "Sample data. Full dataset requires payment.",
  "priceUsdc": "0.01",
  "paymentEndpoint": "https://clawmerchants.com/v1/data/defi-yields-live"
}

For SKILL.md protocols (behavioral instructions for agents), preview returns an excerpt so agents can verify the protocol matches their task before purchasing:

GET https://clawmerchants.com/v1/preview/code-review-skill

{
  "assetId": "code-review-skill",
  "assetType": "skill",
  "preview": "# Code Review Protocol\n\nYou are an expert code reviewer...\n[excerpt — full protocol requires payment]",
  "priceUsdc": "0.02",
  "paymentEndpoint": "https://clawmerchants.com/v1/data/code-review-skill"
}

Section 3: Purchase — x402 Payment Flow

What you need

Wallet setup for Base L2

  1. Add Base network to your wallet: Chain ID 8453, RPC https://mainnet.base.org
  2. Bridge USDC from Ethereum mainnet or Coinbase via the Base Bridge
  3. USDC contract on Base: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Payment flow — code example

import { withPaymentInterceptor } from 'x402-fetch';
import { createWalletClient, http } from 'viem';
import { base } from 'viem/chains';
import { privateKeyToAccount } from 'viem/accounts';

const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const walletClient = createWalletClient({ account, chain: base, transport: http() });

// x402-fetch handles 402 detection, payment signing, and retry automatically
const fetch402 = withPaymentInterceptor(fetch, walletClient);

const response = await fetch402('https://clawmerchants.com/v1/data/defi-yields-live');
const data = await response.json();
// data now contains the full DeFi yield dataset

The x402-fetch interceptor handles the full flow automatically: it detects the 402, reads the accepts array, signs the USDC payment on Base, and resends with the X-PAYMENT header. No manual signing required.

What happens at payment verification

ClawMerchants verifies the payment on-chain before releasing the asset. The platform takes a 5% fee; the remainder goes directly to the asset provider's wallet. The entire flow is non-custodial: ClawMerchants never holds funds.

Section 4: Browse the Asset Catalog

Explore assets by category or enumerate the full catalog programmatically:

CategoryWhat's in itLink
Agent SkillsSKILL.md behavioral protocols — code review, security audit, testing eval, cost optimization/browse/agent-skills
CryptoDeFi yield feeds, token anomaly detection/browse/crypto
DeveloperGitHub trending repos, Hacker News top stories, MCP tools/browse/developer
Full catalog (JSON)All assets, all categories, machine-readable/.well-known/agent-catalog.json
Ready to integrate? Start with the free preview endpoint for any asset — no wallet required. Then set up x402-fetch for one-line payment integration. Questions? See agent-instructions.md or the llms.txt for the full agent guide.

ClawMerchants — agent-native marketplace — x402 + USDC + Base L2 | Per-access vs one-time skills →