# Stop an AI agent before it pays an x402 seller that does not deliver

An x402 seller answers HTTP 402 with a price and a recipient. The agent signs, pays, and only then sees what comes back.
This page lists the checks an agent can run before the signature exists, so a payment that would not deliver is stopped while it can still be stopped.

## 1. Checks the agent can make on its own
Refuse a 402 that arrived over plain http. Set a maximum amount per call and per day in the agent's own code, and refuse any 402 above it. Keep the payTo address the agent paid before for each URL, and stop when a 402 names a different one. These checks need no outside service.

## 2. Read the seller's delivery record
vet402 pays x402 sellers with its own funds and records whether each paid call delivered. GET /api/v1/check?url= returns that record with an ALLOW, WARN, or BLOCK recommendation. It needs no API key and allows 60 requests a minute per IP. Keyless reads of /decision can be paused by the operator.

## 3. Stop a script from the terminal
npx vet402 check followed by the URL prints vet402's decision for that URL. It exits 0 for ALLOW, 1 for BLOCK, 2 for WARN or UNKNOWN, and 3 for a usage or network error, so a script can stop on any code other than 0. It needs no key and no wallet, and nothing is paid.

```bash
npx vet402 check https://api.example.com/v1/quote
echo $?   # 0 ALLOW, 1 BLOCK, 2 WARN or UNKNOWN, 3 usage or network error
```

## 4. Scan the 402 before signing
POST /api/v1/check/presign takes the 402 body the seller returned. For each accept it reports terms_match and reason codes such as payee_mismatch, price_above_declared, and chain_or_asset_mismatch, compared with the terms of the last purchase vet402 saw delivered. The route does not pay, and vet402 does not store the 402 body or the URL.

## 5. Refuse in code before the signer is reached
payOrRefuse in the vet402 package reads the decision first. On BLOCK, on WARN, or when the URL is outside the catalog, it refuses before the 402 is fetched, and the signer is never called. It then compares the 402 with the verified pay_to and amount before it signs. A 0x payee pays on Base and a base58 payee pays on Solana.

```typescript
import { payOrRefuse } from "vet402/buyer";

const r = await payOrRefuse({
  payee: "0x...", // the payTo in the seller's 402
  resource: "https://api.example.com/v1/quote",
  amountUsd: 0.01,
  fetch,
  account: yourSigner,
  network: "base-sepolia",
});
// r.status is "paid" after the checks pass.
// "refused" stops before a signature, with r.decision.reason_codes.
```

## 6. After the payment
Keep the transaction hash with the response. If the payment settled and nothing usable came back, the x402 refunds page explains when a refund is possible. vet402 records past purchases. It does not insure a payment, hold customer funds, or refund one.

Canonical HTML: https://vet402.com/x402/agent-payment-safety
Updated: 2026-11-29
