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

# Create a checkout session

> Creates a checkout session (DB only, no order, no external API calls). The order is created separately via POST /orders with checkoutSessionId.



## OpenAPI

````yaml https://mainnet.anyspend.com/openapi.json post /checkout-sessions
openapi: 3.1.0
info:
  title: AnySpend API
  version: 1.0.0
  description: >-
    API for AnySpend - handles get quote, create order, check order status, and
    more.
servers:
  - url: https://mainnet.anyspend.com
    description: Production server
security: []
tags: []
paths:
  /checkout-sessions:
    post:
      tags:
        - Checkout Sessions
      summary: Create a checkout session
      description: >-
        Creates a checkout session (DB only, no order, no external API calls).
        The order is created separately via POST /orders with checkoutSessionId.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCheckoutSessionRequest'
      responses:
        '200':
          description: Checkout session created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Checkout session created
                  data:
                    $ref: '#/components/schemas/CreateCheckoutSessionResponse'
                  statusCode:
                    type: number
                    example: 200
                required:
                  - success
                  - message
                  - data
                  - statusCode
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Bad request
                  statusCode:
                    type: number
                    example: 400
                required:
                  - success
                  - message
                  - statusCode
components:
  schemas:
    CreateCheckoutSessionRequest:
      type: object
      description: Request body for creating a checkout session
      properties:
        success_url:
          type: string
          format: uri
          description: >-
            URL to redirect to on successful payment. Supports {SESSION_ID} and
            {ORDER_ID} template variables.
          example: https://merchant.com/success?session_id={SESSION_ID}
        cancel_url:
          type: string
          format: uri
          description: >-
            URL to redirect to on cancellation. Supports {SESSION_ID} and
            {ORDER_ID} template variables.
          example: https://merchant.com/cancel
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Arbitrary key-value metadata returned unchanged on retrieval
          example:
            sku: widget-1
            customer_id: cust-123
        client_reference_id:
          type: string
          maxLength: 255
          description: Optional merchant-side reference ID
        expires_in:
          type: number
          description: Session TTL in seconds (min 300, max 86400, default 1800)
          minimum: 300
          maximum: 86400
          default: 1800
          example: 1800
    CreateCheckoutSessionResponse:
      type: object
      description: >-
        Response from creating a checkout session. No order_id, checkout_url, or
        deposit_address — those come after order creation.
      properties:
        id:
          type: string
          format: uuid
          description: Checkout session UUID
          example: 550e8400-e29b-41d4-a716-446655440000
        status:
          $ref: '#/components/schemas/CheckoutSessionStatus'
          example: open
        success_url:
          type: string
          nullable: true
          description: Success redirect URL (unresolved template)
        cancel_url:
          type: string
          nullable: true
          description: Cancel redirect URL (unresolved template)
        metadata:
          type: object
          additionalProperties:
            type: string
        expires_at:
          type: string
          format: date-time
          description: ISO 8601 expiry timestamp
        created_at:
          type: string
          format: date-time
          description: ISO 8601 creation timestamp
      required:
        - id
        - status
        - success_url
        - cancel_url
        - metadata
        - expires_at
        - created_at
    CheckoutSessionStatus:
      type: string
      enum:
        - open
        - processing
        - complete
        - expired
      description: Checkout session status

````