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

# Get Checkout Session

> Returns the Checkout Session with the given id



## OpenAPI

````yaml api-reference/openapi.yaml get /checkout/sessions/{id}
openapi: 3.1.0
info:
  title: CNaught Carbon Credits API Documentation
  contact:
    email: support@cnaught.com
    name: CNaught
    url: https://cnaught.com/
  version: v1
  description: |
    Carbon Credits API Documentation
  termsOfService: https://cnaught.com/terms
  license:
    name: MIT
    url: https://spdx.org/licenses/MIT.html
servers:
  - url: https://api.cnaught.com/v1
    description: CNaught API
security:
  - ApiKey: []
tags:
  - name: Orders
    description: Endpoints for placing orders and retrieving information about orders
  - name: Quotes
    description: Endpoints for obtaining price quotes for orders
  - name: Climate Impact
    description: >-
      Endpoints for retrieving climate impact data and hosted public impact page
      configuration
  - name: Subaccounts
    description: Endpoints for creating and retrieving information about subaccounts
paths:
  /checkout/sessions/{id}:
    parameters:
      - name: id
        in: path
        description: Id of the Checkout Session to retrieve
        required: true
        schema:
          type: string
          examples:
            - zpQ6QSNRQh
    get:
      tags:
        - Checkout Sessions
      summary: Get Checkout Session
      description: Returns the Checkout Session with the given id
      operationId: GetCheckoutSessionById
      responses:
        '200':
          description: Checkout Session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutSession'
              examples:
                Example:
                  value:
                    id: zpQ6QSNRQh
                    amount_kg: 100
                    price_usd_cents: 200
                    success_url: >-
                      https://www.example.com/confirmation?my_query=my_value&session_id={CHECKOUT_SESSION_ID}
                    cancel_url: https://www.example.com/purchase-credits
                    checkout_url: https://checkout.cnaught.com/pay/zpQ6QSNRQh
                    state: open
                    created_on: '2022-07-31T18:00:00.000000Z'
                    expires_on: '2022-08-01T18:00:00.000000Z'
                    completed_on: null
                    portfolio_id: mHvNvWbq
                    order_description: on behalf of Jane Smith
                    order_webhook_url: https://www.example.com/callback
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/CheckoutSessionNotFound'
components:
  schemas:
    CheckoutSession:
      type: object
      properties:
        id:
          type: string
          description: Identifier that can be used to retrieve the Checkout Session
          examples:
            - zpQ6QSNRQh
        amount_kg:
          type: number
          description: >-
            Amount of carbon credits to be purchased upon checkout completion,
            in kilograms
          examples:
            - 10.5
        price_usd_cents:
          type: number
          description: Total price to be charged upon checkout completion, in USD cents
          examples:
            - 2350
        success_url:
          type: string
          description: URL the customer will be redirected to after they complete Checkout.
          examples:
            - https://www.example.com/purchase/success
        cancel_url:
          type: string
          description: >-
            URL the customer will be redirected to if they click the "back"
            button in Checkout.
          examples:
            - https://www.example.com/purchase
        checkout_url:
          type: string
          description: >-
            URL to the Checkout Session. Redirect the customer to this URL to
            take them to Checkout.
          examples:
            - https://checkout.cnaught.com/pay/zpQ6QSNRQh
        state:
          type: string
          description: >
            The status of the Checkout Session, one of `open`, `complete`, or
            `expired`.

            * `open` - The checkout session is still in progress. Payment
            processing has not started.

            * `complete` - The checkout session is complete. Payment processing
            may still be in progress.

            * `expired` - The checkout session has expired. No further
            processing will occur.
        expires_on:
          type: string
          description: Timestamp of when the session will expire.
        completed_on:
          type:
            - string
            - 'null'
          description: >-
            Timestamp of when the session was completed. Null if session has not
            been completed.
        portfolio_id:
          type: string
          description: >-
            Id of the portfolio the customer will purchase from when completing
            Checkout.
        subaccount_id:
          type:
            - string
            - 'null'
          description: Id of the subaccount associated with the customer
        order_description:
          type:
            - string
            - 'null'
          description: >-
            Description to be associated with the order created from this
            session.
        order_webhook_url:
          type:
            - string
            - 'null'
          description: Webhook URL for updates to the order created from this session.
    BaseProblemDetails:
      type: object
      description: Problem details object returned on errors
      properties:
        title:
          type: string
          description: Short, human-readable summary of the problem
        details:
          type: string
          description: Longer, human-readable description of the problem
        type:
          type: string
          description: URI that identifies the problem type
        status:
          type: integer
          description: HTTP status code of the error
  responses:
    Unauthorized:
      description: Request Unauthorized
      content:
        application/problem+json:
          schema:
            properties:
              title:
                type: string
                description: Short, human-readable summary of the problem type
              status:
                type: integer
                description: HTTP status code of the error
          example:
            title: Authorization has been denied for this request
            status: 401
    CheckoutSessionNotFound:
      description: Checkout Session Not Found
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/BaseProblemDetails'
          example:
            type: https://api.cnaught.com/v1/errors/not-found
            title: Could not find checkout session
            status: 404
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer

````