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

# Get checkout session



## OpenAPI

````yaml /api-reference/openapi.json get /checkout/sessions/{id}
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /checkout/sessions/{id}:
    get:
      tags:
        - Checkout
      summary: Get checkout session
      operationId: getCheckoutSession
      parameters:
        - name: id
          in: path
          description: Checkout session ID
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSessionResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CheckoutSessionResponse:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/types.CheckoutAction'
        cancel_url:
          type: string
        cancelled_at:
          type: string
          format: date-time
        checkout_invoice_id:
          type: string
          description: >-
            CheckoutInvoiceID and CheckoutPaymentID are set once the apply step

            creates the corresponding Flexprice entities (completed sessions
            only).
        checkout_payment_id:
          type: string
        checkout_status:
          $ref: '#/components/schemas/types.CheckoutStatus'
        completed_at:
          type: string
          format: date-time
        configuration:
          $ref: '#/components/schemas/checkout.JSONBCheckoutConfiguration'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        customer_id:
          type: string
        environment_id:
          type: string
        expires_at:
          type: string
          description: |-
            ExpiresAt is required. A Temporal timer fires at this time for any
            session still in initiated|pending, marking it expired. The caller
            must create a new session after expiry (expire-and-restart model).
          format: date-time
        failure_reason:
          type: string
          description: FailureReason is a human-readable string set on failed sessions.
        failure_url:
          type: string
        id:
          type: string
        idempotency_key:
          type: string
          description: >-
            IdempotencyKey is caller-supplied. It is unique only while the
            session

            is active (initiated|pending). The same key may be reused once the

            session reaches a terminal state (completed|failed|expired).
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        payment_action:
          $ref: '#/components/schemas/types.PaymentAction'
        payment_provider:
          $ref: '#/components/schemas/types.CheckoutPaymentProvider'
        provider_result:
          $ref: '#/components/schemas/checkout.JSONBCheckoutProviderResult'
        result:
          $ref: '#/components/schemas/checkout.JSONBCheckoutResult'
        status:
          $ref: '#/components/schemas/types.Status'
        success_url:
          type: string
          description: >-
            Redirect URLs sent to the payment provider. The provider redirects
            the

            user browser to the appropriate URL after the payment flow
            completes.
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    errors.ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/errors.ErrorCode'
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.CheckoutAction:
      type: string
      enum:
        - create_subscription
      x-enum-varnames:
        - CheckoutActionCreateSubscription
      x-speakeasy-name-override: CheckoutAction
    types.CheckoutStatus:
      type: string
      enum:
        - initiated
        - pending
        - completed
        - failed
        - expired
      x-enum-varnames:
        - CheckoutStatusInitiated
        - CheckoutStatusPending
        - CheckoutStatusCompleted
        - CheckoutStatusFailed
        - CheckoutStatusExpired
      x-speakeasy-name-override: CheckoutStatus
    checkout.JSONBCheckoutConfiguration:
      type: object
      properties:
        create_subscription_params:
          $ref: '#/components/schemas/types.CreateSubscriptionParams'
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    types.PaymentAction:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/types.PaymentActionType'
        url:
          type: string
      x-speakeasy-name-override: PaymentAction
    types.CheckoutPaymentProvider:
      type: string
      enum:
        - razorpay
      x-enum-varnames:
        - CheckoutPaymentProviderRazorpay
      x-speakeasy-name-override: CheckoutPaymentProvider
    checkout.JSONBCheckoutProviderResult:
      type: object
      properties:
        expires_at:
          type: string
          description: >-
            ExpiresAt is the provider URL expiry. When set and earlier than the
            session expiry,

            executeCheckoutAction tightens the session expiry to match.
          format: date-time
        next_action:
          $ref: '#/components/schemas/types.PaymentAction'
        provider_metadata:
          type: object
          additionalProperties:
            type: string
          description: >-
            ProviderMetadata holds provider-specific data not needed for
            business logic.
        provider_payment_intent_id:
          type: string
          description: >-
            ProviderPaymentIntentID is the provider-side charge/intent ID.

            Stripe returns this at link creation (pi_xxx); others populate it
            from the webhook payload.
        provider_session_id:
          type: string
          description: >-
            ProviderSessionID is stored in EntityIntegrationMapping at link
            creation.
              Stripe:   Checkout Session ID  (cs_xxx)
              Razorpay: Payment Link ID      (plink_xxx)
              Nomod:    Payment Link ID      (NOTE: webhook uses Charge ID; look up by PaymentLinkID field)
              Moyasar:  Payment ID
    checkout.JSONBCheckoutResult:
      type: object
      properties:
        create_subscription_result:
          $ref: '#/components/schemas/types.CreateSubscriptionResult'
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    errors.ErrorCode:
      type: string
      enum:
        - http_client_error
        - system_error
        - internal_error
        - not_found
        - already_exists
        - version_conflict
        - validation_error
        - invalid_operation
        - permission_denied
        - database_error
        - service_unavailable
        - too_many_requests
      x-enum-varnames:
        - ErrCodeHTTPClient
        - ErrCodeSystemError
        - ErrCodeInternalError
        - ErrCodeNotFound
        - ErrCodeAlreadyExists
        - ErrCodeVersionConflict
        - ErrCodeValidation
        - ErrCodeInvalidOperation
        - ErrCodePermissionDenied
        - ErrCodeDatabase
        - ErrCodeServiceUnavailable
        - ErrCodeTooManyRequests
      x-speakeasy-name-override: ErrorCode
    types.CreateSubscriptionParams:
      type: object
      properties:
        billing_period:
          $ref: '#/components/schemas/types.BillingPeriod'
        currency:
          type: string
        end_date:
          type: string
          format: date-time
        lookup_key:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        plan_id:
          type: string
        start_date:
          type: string
          format: date-time
      x-speakeasy-name-override: CreateSubscriptionParams
    types.PaymentActionType:
      type: string
      enum:
        - checkout_url
        - payment_link
      x-enum-varnames:
        - PaymentActionTypeCheckoutURL
        - PaymentActionTypePaymentLink
      x-speakeasy-name-override: PaymentActionType
    types.CreateSubscriptionResult:
      type: object
      properties:
        invoice_id:
          type: string
        payment_id:
          type: string
        subscription_id:
          type: string
      x-speakeasy-name-override: CreateSubscriptionResult
    types.BillingPeriod:
      type: string
      enum:
        - MONTHLY
        - ANNUAL
        - WEEKLY
        - DAILY
        - QUARTERLY
        - HALF_YEARLY
        - ONETIME
      x-enum-varnames:
        - BILLING_PERIOD_MONTHLY
        - BILLING_PERIOD_ANNUAL
        - BILLING_PERIOD_WEEKLY
        - BILLING_PERIOD_DAILY
        - BILLING_PERIOD_QUARTER
        - BILLING_PERIOD_HALF_YEAR
        - BILLING_PERIOD_ONETIME
      x-speakeasy-name-override: BillingPeriod
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````