Skip to content

Pay x402 resources with AllowKit

AllowKit wraps paid x402 requests with spending controls. When a resource returns 402 Payment Required, AllowKit:

  1. parses the payment requirement
  2. checks the active allowance policy
  3. approves, blocks, or requests human confirmation
  4. submits payment if allowed
  5. retries the request with payment proof
  6. records a receipt
Agent
│
│ GET paid resource
▼
Resource
│
│ 402 Payment Required
▼
AllowKit
│
│ check policy + allowance
│ pay if approved
▼
Resource
│
│ retry with payment proof
▼
Agent receives response
agent.ts
import { allowkitFetch } from "@allowkit/x402"; // roadmap — not yet shipped
const fetchWithPayment = allowkitFetch({
allowanceId: "alw_research_agent",
policy: {
maxPerRequestUsd: 0.10,
maxPerDayUsd: 10,
allowedHosts: ["*.paid-api.com"],
requireApprovalAboveUsd: 1
}
});
const response = await fetchWithPayment("https://data.paid-api.com/report");