Agent-to-agent x402

Agent Payment Verification API

Verify a signed x402 payment payload against payment requirements before settlement. The API is idempotent, stores only safe summaries, and never submits a payment on-chain.

Endpoint

POST/api/agent/verify-payment creates or replays a verification result. Requires Idempotency-Key.
GET/api/agent/verify-payment?verification_id=... or Idempotency-Key retrieves the stored result.

Request

curl -X POST https://ontarioprotocol.com/api/agent/verify-payment \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: agent-a-payment-2026-05-19-001" \
  -d '{
    "payment_payload": {"x402Version": 1, "scheme": "exact", "network": "base", "payload": {"signature": "0x...", "authorization": {"from": "0xBuyer", "to": "0xSeller", "value": "10000", "nonce": "0x..."}}},
    "payment_requirements": {"scheme": "exact", "network": "base", "maxAmountRequired": "10000", "resource": "https://seller.example/api/task", "description": "Agent task", "mimeType": "application/json", "payTo": "0xSeller", "maxTimeoutSeconds": 60, "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "extra": {"nonce": "abc", "validUntil": 1893456000}},
    "expected": {"resource": "https://seller.example/api/task", "amount_atomic": "10000", "network": "base"},
    "agent_context": {"payer_agent_id": "buyer-agent", "payee_agent_id": "seller-agent"}
  }'

Response Contract

Responses use schema ontario.agent_payment_verification.v1. Status is valid or invalid. The result includes local checks, optional facilitator verification, safe payment summaries, and settlement_attempted: false.

{
  "schema": "ontario.agent_payment_verification.v1",
  "verification_id": "apv_...",
  "status": "valid",
  "settlement_attempted": false,
  "summary": {"resource": "https://seller.example/api/task", "network": "base", "amount_atomic": "10000"}
}

Beta Integration Targets

The API is designed for MCP paid tools, A2A task routers, and wallet policy agents that need a reusable verification record before settlement.