创建订阅结账会话

OpenAPI 契约

方法
POST
路径
/api/v1/billing/checkout/subscription
认证
jwtBearer (bearer)
响应状态
200 400 401 403 429 500
请求与响应 Schema
JSON
{
  "requestBody": {
    "application/json": {
      "$ref": "#/components/schemas/PlanRequest"
    }
  },
  "responses": {
    "200": {
      "description": "Checkout URL",
      "content": {
        "application/json": {}
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

POST /api/v1/billing/checkout/subscription 仅限 JWT。发送具有已配置 Stripe 价格的活跃计划的非空 planCode;可选 Idempotency-Key 会转发给 Stripe。响应仅为 { "redirectUrl": "..." },即托管 Checkout 会话 URL。它本身不会创建或激活订阅。

可用性:已按源码/配置核实。 本页说明服务端路径与配置行为,不表示已完成付款。Stripe 确认和订阅更新由支付服务商 Webhook 处理;该 Webhook 有意不属于公开 API Reference。

http
POST /api/v1/billing/checkout/subscription
Authorization: Bearer <access token>
Content-Type: application/json
Idempotency-Key: <unique key>

{"planCode":"PRO"}