{
 "openapi": "3.1.0",
 "info": {
  "title": "ManHourPlan agent tools: credit checkout",
  "version": "1.0.0",
  "description": "Card checkout for MCP credit packs (VerifAI, SiteDoctor, RugShield). Tools themselves are MCP (see /.well-known/mcp.json); Wallet Doctor uses x402 (see /.well-known/x402.json).",
  "contact": {
   "email": "support@manhourplan.com"
  }
 },
 "servers": [
  {
   "url": "https://manhourplan.com/credits"
  }
 ],
 "paths": {
  "/checkout": {
   "get": {
    "operationId": "startCreditCheckout",
    "summary": "Redirect to Stripe Checkout for a credit pack (a human completes payment)",
    "parameters": [
     {
      "name": "product",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "verifai",
        "sitedoctor",
        "rugshield"
       ]
      }
     },
     {
      "name": "pack",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "9",
        "29",
        "99"
       ]
      },
      "description": "USD price: 9 = 1,000 credits, 29 = 10,000, 99 = 100,000"
     },
     {
      "name": "api_key",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "description": "Existing key to top up; omit to receive a new key"
     }
    ],
    "responses": {
     "303": {
      "description": "Redirect to checkout.stripe.com"
     },
     "400": {
      "description": "Unknown product/pack or unknown api_key"
     }
    }
   }
  },
  "/status": {
   "get": {
    "operationId": "checkoutStatus",
    "summary": "Whether a paid session has been credited",
    "parameters": [
     {
      "name": "session_id",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Credited",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ready": {
           "type": "boolean"
          },
          "product": {
           "type": "string"
          },
          "credits_added": {
           "type": "integer"
          },
          "api_key": {
           "type": "string"
          },
          "new_key": {
           "type": "boolean"
          }
         }
        }
       }
      }
     },
     "202": {
      "description": "Not credited yet"
     }
    }
   }
  }
 }
}