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

# Create a checkout session

> Creates a hosted checkout session for a customer to purchase a product plan. Returns a session ID and checkout URL for redirect.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/sdk/checkout-sessions
openapi: 3.0.0
info:
  contact: {}
  description: The SolvaPay REST API specification
  title: SolvaPay REST API
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /v1/sdk/checkout-sessions:
    post:
      tags:
        - Checkout Sessions
      summary: Create a checkout session
      description: >-
        Creates a hosted checkout session for a customer to purchase a product
        plan. Returns a session ID and checkout URL for redirect.
      operationId: CheckoutSessionSdkController_createCheckoutSession
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCheckoutSessionRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCheckoutSessionResponse'
          description: Checkout session created
        '400':
          description: Missing customerRef or productRef
      security:
        - SecretKey: []
components:
  schemas:
    CreateCheckoutSessionRequest:
      properties:
        customerRef:
          maxLength: 20
          minLength: 1
          type: string
        planRef:
          maxLength: 20
          type: string
        productRef:
          maxLength: 20
          minLength: 1
          type: string
        purpose:
          enum:
            - credit_topup
          type: string
        returnUrl:
          type: string
      required:
        - customerRef
      type: object
    CreateCheckoutSessionResponse:
      properties:
        checkoutUrl:
          description: >-
            Full checkout URL based on backend configuration (ready to redirect
            customer)
          example: >-
            https://solvapay.com/customer/checkout?id=e3f1c2d4b6a89f001122334455667788
          type: string
        sessionId:
          description: Checkout session ID/token
          example: e3f1c2d4b6a89f001122334455667788
          type: string
      required:
        - sessionId
        - checkoutUrl
      type: object
  securitySchemes:
    SecretKey:
      bearerFormat: JWT
      description: >-
        Provider secret API key (sk_live_… / sk_test_…) supplied as a Bearer
        token.
      scheme: bearer
      type: http

````