Payments
Viewing and filtering the payment audit trail.
Every payment produces an audit record. This page covers how to query and interpret them.
Record Structure
| Field | Description |
|---|---|
id | Deterministic hash ID |
agent_id | Agent that made the payment |
team | Team grouping |
amount | Human-readable USDC (e.g., "0.50") |
endpoint | Full URL called |
tx_hash | On-chain transaction hash |
policy_evaluation | "allowed" | "flagged" | "blocked" |
created_at | Unix timestamp (ms) |
tags | Enrichment tags |
Querying Payments
import { AuditLogger } from "@valeo/x402";
const logger = new AuditLogger({ storage });
const records = await logger.query({
agentId: "agent-weather-001",
startTime: Date.now() - 86400000,
endTime: Date.now(),
status: ["allowed", "flagged"],
minAmount: "0.10",
limit: 100,
orderBy: "created_at",
order: "desc",
});Spend Reports
const report = await dashboard.getSpend({
agentId: "agent-1",
range: "last_day",
});
console.log(report.totalSpend); // "$123.45"
console.log(report.count); // 42
console.log(report.byAgent);
console.log(report.byEndpoint);Violations & Anomalies
import { violations, anomalies } from "@valeo/x402/dashboard";
const blocked = await violations(storage, "last_day");
const flagged = await anomalies(storage, "last_day");
const alerts = await dashboard.getAlerts();