> ## Documentation Index
> Fetch the complete documentation index at: https://devkit4ai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Checkout Session

> Create a Stripe checkout session for subscription or one-time payment. Returns a URL to redirect the user to Stripe's hosted checkout page.



## OpenAPI

````yaml cloud-api/openapi.json post /api/v1/payments/stripe/checkout-session
openapi: 3.1.0
info:
  title: Dev Kit for AI API
  description: 'API for Dev Kit for AI: Developer Toolkit for AI-Powered Web Applications'
  version: 1.6.1
servers:
  - url: https://api.devkit4ai.com
    description: Dev Kit for AI Production Server
  - url: https://api.vibecoding.ad
    description: Vibe Coding Production Server
security: []
paths:
  /api/v1/payments/stripe/checkout-session:
    post:
      tags:
        - Stripe Checkout
      summary: Create Checkout Session
      description: >-
        Create a Stripe checkout session for subscription or one-time payment.
        Returns a URL to redirect the user to Stripe's hosted checkout page.
      operationId: create_checkout_session_api_v1_payments_stripe_checkout_session_post
      parameters:
        - name: test_mode
          in: query
          required: false
          schema:
            type: boolean
            description: Use test mode credentials
            default: true
            title: Test Mode
          description: Use test mode credentials
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StripeCheckoutRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StripeCheckoutResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    StripeCheckoutRequest:
      properties:
        price_id:
          type: string
          minLength: 1
          title: Price Id
        success_url:
          type: string
          minLength: 1
          title: Success Url
        cancel_url:
          type: string
          minLength: 1
          title: Cancel Url
        mode:
          type: string
          pattern: ^(subscription|payment)$
          title: Mode
          default: subscription
        quantity:
          type: integer
          minimum: 1
          title: Quantity
          default: 1
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        allow_existing_subscription:
          type: boolean
          title: Allow Existing Subscription
          description: If true, allows checkout even if user has active subscription
          default: false
      type: object
      required:
        - price_id
        - success_url
        - cancel_url
      title: StripeCheckoutRequest
      description: Request to create a Stripe checkout session.
    StripeCheckoutResponse:
      properties:
        session_id:
          type: string
          title: Session Id
        checkout_url:
          type: string
          title: Checkout Url
      type: object
      required:
        - session_id
        - checkout_url
      title: StripeCheckoutResponse
      description: Stripe checkout session response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: auth/login

````