{
  "openapi": "3.1.0",
  "info": {
    "title": "DodaPay Merchant API",
    "version": "1.0.0",
    "description": "Production API for DodaPay merchants: create crypto checkouts, track payment status, manage webhooks, and reconcile settlements. Authenticate with API keys issued from the merchant dashboard."
  },
  "servers": [
    {"url": "https://api.dodapay.com", "description": "Production API"}
  ],
  "security": [{"ApiKeyAuth": []}],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Bearer token or DodaPay-Key header per dashboard integration guide"
      }
    }
  },
  "paths": {
    "/v1/payments": {
      "post": {
        "summary": "Create payment intent / checkout session",
        "operationId": "createPayment",
        "security": [{"ApiKeyAuth": []}],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["amount", "currency"],
                "properties": {
                  "amount": {"type": "string", "example": "99.00"},
                  "currency": {"type": "string", "example": "USD"},
                  "network": {"type": "string", "example": "ethereum"},
                  "asset": {"type": "string", "example": "USDT"}
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment created; returns checkout URL and QR payload"
          },
          "402": {
            "description": "Payment required (agent settlement flow)"
          }
        },
        "x-payment-info": {
          "intent": "charge",
          "method": "crypto",
          "currency": "USD",
          "note": "MPP-compatible agents may negotiate settlement via documented facilitator flow."
        }
      }
    },
    "/v1/payments/{id}": {
      "get": {
        "summary": "Get payment status",
        "operationId": "getPayment",
        "security": [{"ApiKeyAuth": []}],
        "parameters": [
          {"name": "id", "in": "path", "required": true, "schema": {"type": "string"}}
        ],
        "responses": {
          "200": {"description": "Payment state and confirmations"}
        }
      }
    },
    "/v1/webhooks/endpoints": {
      "get": {
        "summary": "List configured webhook endpoints",
        "security": [{"ApiKeyAuth": []}],
        "responses": {"200": {"description": "Registered webhook URLs"}}
      }
    }
  },
  "x-dodapay": {
    "x402": {
      "enabled": true,
      "facilitator_docs": "https://docs.x402.org"
    },
    "dashboard": "https://dodapay.com/dashboard.html"
  }
}
