{
  "openapi": "3.1.0",
  "info": {
    "title": "Base USDC Receipt Verifier",
    "version": "0.1.0",
    "contact": {
      "name": "Solo Earn",
      "email": "soloearn@agentmail.to"
    },
    "x-guidance": "Call GET /v1/verify to check a Base USDC payment; POST /v1/consume to also mark it used once. Both are x402 v2 exact USDC on Base.",
    "description": "x402 pay-per-call (USDC on Base). See https://usdc-receipt-verifier.soloearn.workers.dev/"
  },
  "servers": [
    {
      "url": "https://usdc-receipt-verifier.soloearn.workers.dev"
    }
  ],
  "paths": {
    "/v1/verify": {
      "get": {
        "operationId": "verifyUsdcPayment",
        "summary": "Verify that a Base mainnet transaction paid at least N USDC to an address (optionally from a given sender, with K confirmations). Returns matched transfer, block time and confirmations. Read-only.",
        "x-x402-price-usdc": "0.005",
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.005"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "parameters": [
          {
            "name": "tx",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Base tx hash"
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "recipient address"
          },
          {
            "name": "min",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "minimum USDC that counts as paid, e.g. 29 (required, > 0)"
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "required sender"
          },
          {
            "name": "confirmations",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1..1000, default 1"
          }
        ],
        "responses": {
          "200": {
            "description": "Verification report"
          },
          "400": {
            "description": "Invalid input (never charged)"
          },
          "402": {
            "description": "Payment required"
          },
          "503": {
            "description": "Chain read failed (never charged)"
          }
        }
      }
    },
    "/v1/consume": {
      "post": {
        "operationId": "consumeUsdcPayment",
        "summary": "Verify a Base USDC payment and mark it used exactly once in your private namespace (replay protection for sellers without a database). Second use of the same tx returns first_use:false.",
        "x-x402-price-usdc": "0.01",
        "security": [],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.01"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tx",
                  "to",
                  "min",
                  "namespace"
                ],
                "properties": {
                  "tx": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "min": {
                    "type": "string"
                  },
                  "from": {
                    "type": "string"
                  },
                  "confirmations": {
                    "type": "integer"
                  },
                  "namespace": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification + first_use"
          },
          "400": {
            "description": "Invalid input (never charged)"
          },
          "402": {
            "description": "Payment required"
          },
          "503": {
            "description": "Chain read failed (never charged)"
          }
        }
      }
    }
  }
}