# Ekx X402

> The x402 HTTP payment standard — charging for API access with HTTP 402, USDC settlement on Base, buyer and seller SDKs, facilitators, and agent-to-agent payments. Use when building a paid API endpoint, when an agent needs to pay per request, or when integrating the Bazaar discovery layer.

- Skill: `ekinoxis-evm/ekx-x402` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ekinoxis-evm/ekx-x402`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ekinoxis-evm/ekx-x402/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Product & Planning
- Author: Ekinoxis-evm (https://skillmd.com/u/ekinoxis-evm)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/ekinoxis-evm/ekx-x402

---


# x402

Pay-per-request HTTP payments settled in USDC on Base.

Alchemy's endpoint: `https://x402.alchemy.com` · Coinbase facilitator:
`https://api.cdp.coinbase.com/platform/v2/x402`

This file records *our* position on it, not the protocol spec.

---

## The idea

A server responds `402 Payment Required` with a `PAYMENT-REQUIRED` header describing
price and network. The client signs a USDC payment, retries with `PAYMENT-SIGNATURE`,
and gets the resource. Settlement is ~1 second on Base, no protocol fee, no account.

Headers: `PAYMENT-REQUIRED` → `PAYMENT-SIGNATURE` → `PAYMENT-RESPONSE`.
Networks are CAIP-2: Base mainnet is `eip155:8453`, Base Sepolia `eip155:84532`.
Schemes: `exact` (fixed price) or `upto` (usage-based, EVM only).

---

## Why it matters to us

It is the only clean answer to *"how does an autonomous agent pay for something?"*
No API key to provision, no subscription, no human in the loop. That maps directly
onto a P2P agent and any future Ekinoxis agent product.

It is **early**. Treat it as a bet, not infrastructure — build the paid endpoint so
that x402 is one payment path among others, not the only door.

---

## Seller (Next.js)

```ts
import { paymentMiddleware } from "@x402/next";

export const middleware = paymentMiddleware(
  process.env.DESTINATION_WALLET!,       // where USDC lands
  { "/api/score": { price: "$0.01", network: "eip155:8453" } },
  { url: "https://api.cdp.coinbase.com/platform/v2/x402" },   // facilitator
);
```

## Buyer

```ts
import { wrapFetchWithPayment } from "@x402/fetch";
const paidFetch = wrapFetchWithPayment(fetch, walletClient);
const res = await paidFetch("https://api.example.com/score");
```

---

## Rules we apply

1. **Cap spend per agent run.** A buyer wallet with an unbounded loop and a paid endpoint is a money leak with no error message. Budget per session and hard-stop.
2. **Testnet first** — `eip155:84532` with faucet USDC ([`../ekx-circle-usdc/SKILL.md`](../ekx-circle-usdc/SKILL.md)).
3. **Settlement is not delivery.** Verify `PAYMENT-RESPONSE` before treating the resource as paid for; log both sides for reconciliation.
4. **The receiving wallet is a hot wallet.** Sweep to treasury; do not accumulate.
5. **Price in USDC, 6 decimals.** `"$0.01"` = `10000` units.

Related: [`../ekx-tempo/SKILL.md`](../ekx-tempo/SKILL.md) — MPP is the same idea on Tempo.

