# x402 Pre-Payment Safety Check

> x402 Pre-Payment Safety Check is a paid API for AI agents from kr-x402-mvp.kgy5612.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-31).

Fetches any x402-protected URL unpaid and decodes its 402 payment quote to expose pricing, network, asset, and risk signals before an agent commits funds

## Facts

- Endpoint: GET https://kr-x402-mvp.kgy5612.workers.dev/crypto/x402-check?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-pre-payment-safety-check-0643a0a3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_NkJ_qbrrq_EPPQ69xpXSH

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-pre-payment-safety-check-0643a0a3
```

Example prompt: Before paying, check whether this x402 endpoint is safe and affordable — probe https://kr-x402-mvp.kgy5612.workers.dev/crypto/ping and tell me the verdict, price in USD, which network and asset it wants, and whether the payTo address looks legitimate.

## When to prefer this

Use this endpoint whenever an AI agent needs to pre-flight an x402-protected API before committing USDC — especially useful for budget enforcement (max_usd), asset/network validation (confirming canonical USDC on Base vs. other chains), risk scoring unknown payTo addresses, and confirming Bazaar schema compliance. Prefer this over blindly paying a 402 response when operating in automated pipelines where unexpected charges or malicious payTo addresses are a concern.

## Known failure modes

- Target URL is unreachable — reachable: false, no options decoded
- Target URL does not return a 402 — verdict may indicate non-x402 endpoint
- Malformed or missing PAYMENT-REQUIRED header — parse failure, empty options array
- TLS error on target — flagged in flags array
- Price exceeds max_usd — within_budget: false
- Non-canonical asset (not USDC) — is_usdc: false flagged in cheapest_option
- x402 version mismatch or unsupported scheme — flagged in reasons
- Self-test fallback used when url param is omitted

## How this service works

Should my agent pay this x402 endpoint? Live pre-payment check of ANY x402 URL (never pays it): we GET the target unpaid and decode its 402 quote (PAYMENT-REQUIRED header for v2, JSON body for v1) -> x402 version, every accepts[] option with real USD price (atomic amount / decimals), network name, asset (is it canonical USDC on that chain?), scheme, payTo, maxTimeoutSeconds, resource URL match, Bazaar discovery schema present?, description, latency_ms and TLS.

## Output

A JSON object containing: a human-readable verdict (e.g. SAFE_TO_PAY), a boolean should_pay, a numeric risk_score (0–1), the cheapest payment option (price_usd, asset_label, network_name, payTo, scheme, is_usdc, max_timeout_s), whether the endpoint is within the requested budget, x402 protocol version, whether a Bazaar discovery schema is present, the resource URL and description, reachability status, latency_ms, TLS info, HTTP status, and a list of reasons and flags explaining the assessment.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "url": {
       "type": "string",
       "examples": [
        "https://kr-x402-mvp.kgy5612.workers.dev/crypto/ping"
       ],
       "maxLength": 2048,
       "description": "Absolute https URL of the x402 endpoint to check, with its query string (alias endpoint=; omitted = self-test on /crypto/ping)"
      },
      "method": {
       "enum": [
        "GET",
        "POST"
       ],
       "type": "string",
       "description": "Probe method (default GET)"
      },
      "max_usd": {
       "type": "number",
       "minimum": 0,
       "examples": [
        0.01
       ],
       "description": "Optional budget per call in USD; sets within_budget"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://kr-x402-mvp.kgy5612.workers.dev/crypto/ping",
  "flags": [],
  "options": [],
  "reasons": [
   "402 quote parsed: 1 option(s)",
   "cheapest $0.001 USDC on base"
  ],
  "verdict": "SAFE_TO_PAY",
  "resource": {
   "url": "https://kr-x402-mvp.kgy5612.workers.dev/crypto/ping",
   "host_match": true,
   "description": "Paid heartbeat"
  },
  "reachable": true,
  "checked_at": "2026-10-30T07:30:00Z",
  "latency_ms": 180,
  "risk_score": 0,
  "should_pay": true,
  "http_status": 402,
  "x402_version": 2,
  "bazaar_schema": true,
  "payto_onchain": {
   "chain": "base",
   "is_contract": false,
   "usdc_balance": 0.079
  },
  "within_budget": true,
  "cheapest_option": {
   "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
   "payTo": "0xe4be4d0bd82d8e68203deff81f79ede0529f2617",
   "scheme": "exact",
   "is_usdc": true,
   "network": "eip155:8453",
   "price_usd": 0.001,
   "asset_label": "USDC",
   "network_name": "base",
   "max_timeout_s": 300
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-pre-payment-safety-check-0643a0a3/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from kr-x402-mvp.kgy5612.workers.dev](https://www.zero.xyz/host/kr-x402-mvp.kgy5612.workers.dev/llms.txt)
