{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pageaudit/json-schema/pageaudit-billing-schema.json",
  "title": "Billing",
  "description": "Everything that decides whether the next call will cost: the x402 configuration, the prices, the usage and the trial.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pageaudit-billing-api-openapi.yml#/components/schemas/Billing",
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "Always `x402` — the only billing protocol accepted."
    },
    "mode": {
      "type": "string",
      "description": "Seller mode: `live` charges for real, `dev` lets calls through unpaid."
    },
    "network": {
      "type": "string",
      "description": "USDC network: `base` in production, `base-sepolia` in staging."
    },
    "chain_id": {
      "type": "integer",
      "description": "EVM chain ID of the network above, so the wallet signs on the right chain."
    },
    "pay_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "Address that receives the payment."
    },
    "homolog": {
      "type": "boolean",
      "description": "Staging seam on: the loop can be closed without spending USDC."
    },
    "dev": {
      "type": "boolean",
      "description": "Development mode: the 402 is simulated."
    },
    "dev_gate": {
      "type": [
        "string",
        "null"
      ],
      "description": "How dev mode is unlocked, when it exists."
    },
    "facilitator": {
      "type": "string",
      "description": "URL of the facilitator that verifies and settles the payment."
    },
    "asset": {
      "type": "string",
      "description": "Accepted currency — always `USDC`."
    },
    "asset_address": {
      "type": "string",
      "description": "USDC contract on the network above."
    },
    "faucet": {
      "type": [
        "string",
        "null"
      ],
      "description": "Test-USDC faucet; only on base-sepolia."
    },
    "wallets": {
      "type": "object",
      "description": "Links to wallets that speak x402 (metamask, coinbase, base_app)."
    },
    "product": {
      "type": "string",
      "description": "Name of the product charging."
    },
    "free_max_tabs": {
      "type": "integer",
      "description": "Free tabs per owner."
    },
    "prices": {
      "allOf": [
        {
          "$ref": "#/$defs/Precos"
        }
      ],
      "description": "What each paid action costs, in USD."
    },
    "usage": {
      "allOf": [
        {
          "$ref": "#/$defs/Uso"
        }
      ],
      "description": "How much of the free allowance has been used."
    },
    "trial": {
      "allOf": [
        {
          "$ref": "#/$defs/Trial"
        }
      ],
      "description": "The account's trial, when there is a session."
    }
  },
  "required": [
    "provider",
    "mode",
    "network",
    "chain_id",
    "pay_to",
    "homolog",
    "dev",
    "dev_gate",
    "facilitator",
    "asset",
    "asset_address",
    "faucet",
    "wallets",
    "product",
    "free_max_tabs",
    "prices",
    "usage",
    "trial"
  ],
  "$defs": {
    "Precos": {
      "type": "object",
      "properties": {
        "extra_tab_usd": {
          "type": "number",
          "description": "Cost of a tab beyond the allowance."
        },
        "contact_agent_usd": {
          "type": "number",
          "description": "Cost of an agent contact."
        }
      },
      "required": [
        "extra_tab_usd",
        "contact_agent_usd"
      ],
      "description": "Prices in force, in dollars. Read them here, not from the documentation."
    },
    "Trial": {
      "type": "object",
      "properties": {
        "days": {
          "type": "integer",
          "description": "Trial length in days."
        },
        "active": {
          "type": "boolean",
          "description": "Whether it is in force now."
        },
        "days_left": {
          "type": "integer",
          "description": "How many days remain."
        },
        "ends_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "When it ends (UTC)."
        },
        "granted": {
          "type": "boolean",
          "description": "`true` when THIS call granted the trial."
        }
      },
      "required": [
        "days",
        "active",
        "ends_at"
      ],
      "description": "The paywall-free period that confirming the e-mail grants. It is the alternative to paying."
    },
    "Uso": {
      "type": "object",
      "properties": {
        "tabs": {
          "type": "integer",
          "description": "Tabs open now."
        },
        "free_slots_left": {
          "type": "integer",
          "description": "Free tabs still available."
        }
      },
      "required": [
        "tabs",
        "free_slots_left"
      ],
      "description": "How much of the free allowance the owner has used."
    }
  }
}