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

# Get payment session

> Returns a single payment session with its current status and provider data.



## OpenAPI

````yaml /api-reference/store.yaml get /api/v3/store/carts/{cart_id}/payment_sessions/{id}
openapi: 3.0.3
info:
  title: Store API
  contact:
    name: Spree Commerce
    url: https://spreecommerce.org
    email: hello@spreecommerce.org
  description: >
    Spree Store API v3 - Customer-facing storefront API for building headless
    commerce experiences.


    ## Authentication


    The Store API uses two authentication methods:


    ### API Key (Required)

    All requests must include a publishable API key in the `x-spree-api-key`
    header.


    ### JWT Bearer Token (For authenticated customers)

    After login, include the JWT token in the `Authorization: Bearer <token>`
    header.


    ### Order Token (For guest checkout)

    When creating an order, a `token` is returned. Include this in the
    `x-spree-token` header

    for guest access to that specific order.


    ## Response Format


    All responses are JSON. List endpoints return paginated responses with
    `data` and `meta` keys.


    ## Error Handling


    Errors return a consistent format:

    ```json

    {
      "error": {
        "code": "record_not_found",
        "message": "Product not found"
      }
    }

    ```
  version: v3
servers:
  - url: http://{defaultHost}
    variables:
      defaultHost:
        default: localhost:3000
security: []
tags:
  - name: Authentication
    description: Customer authentication (login, logout, token refresh)
  - name: Product Catalog
    description: Products and categories
  - name: Carts
    description: Shopping cart management
  - name: Orders
    description: Order lookup
  - name: Customers
    description: Customer account, addresses, saved payment methods, and order history
  - name: Markets
    description: Markets, countries, currencies, and locales
  - name: Wishlists
    description: Customer wishlists
  - name: Policies
    description: Store policies (return policy, privacy policy, terms of service)
  - name: Digitals
    description: Digital product downloads
paths:
  /api/v3/store/carts/{cart_id}/payment_sessions/{id}:
    parameters:
      - name: x-spree-api-key
        in: header
        required: true
        schema:
          type: string
      - name: Authorization
        in: header
        required: false
        description: Bearer token for authenticated customers
        schema:
          type: string
      - name: cart_id
        in: path
        required: true
        description: Cart prefixed ID
        schema:
          type: string
      - name: id
        in: path
        required: true
        description: Payment session ID
        schema:
          type: string
      - name: x-spree-token
        in: header
        required: false
        description: Order token for guest access
        schema:
          type: string
    get:
      tags:
        - Carts
      summary: Get payment session
      description: >-
        Returns a single payment session with its current status and provider
        data.
      responses:
        '200':
          description: payment session found
          content:
            application/json:
              example:
                id: ps_UkLWZg9DAJ
                status: pending
                currency: USD
                external_id: bogus_d12a4c4449ea25cafcca4b0b
                external_data:
                  client_secret: secret_123
                customer_external_id: null
                expires_at: null
                amount: '110.0'
                payment_method_id: pm_UkLWZg9DAJ
                order_id: or_UkLWZg9DAJ
                payment_method:
                  id: pm_UkLWZg9DAJ
                  name: Credit Card
                  description: null
                  type: Spree::Gateway::Bogus
                  session_required: true
                  source_required: true
              schema:
                $ref: '#/components/schemas/PaymentSession'
        '404':
          description: payment session not found
          content:
            application/json:
              example:
                error:
                  code: record_not_found
                  message: Payment session not found
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - api_key: []
          bearer_auth: []
      x-codeSamples:
        - lang: javascript
          label: Spree SDK
          source: >-
            import { createClient } from '@spree/sdk'


            const client = createClient({
              baseUrl: 'https://your-store.com',
              publishableKey: '<api-key>',
            })


            const session = await
            client.carts.paymentSessions.get('cart_abc123', 'ps_abc123', {
              bearerToken: '<token>',
            })
components:
  schemas:
    PaymentSession:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
        currency:
          type: string
        external_id:
          type: string
        external_data:
          type: object
        customer_external_id:
          type: string
          nullable: true
        expires_at:
          type: string
          nullable: true
        amount:
          type: string
        payment_method_id:
          type: string
        order_id:
          type: string
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
        payment:
          $ref: '#/components/schemas/Payment'
      required:
        - id
        - status
        - currency
        - external_id
        - external_data
        - customer_external_id
        - expires_at
        - amount
        - payment_method_id
        - order_id
        - payment_method
      x-typelizer: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: record_not_found
            message:
              type: string
              example: Record not found
            details:
              type: object
              description: Field-specific validation errors
              nullable: true
              example:
                name:
                  - is too short
                  - is required
                email:
                  - is invalid
          required:
            - code
            - message
      required:
        - error
      example:
        error:
          code: validation_error
          message: Validation failed
          details:
            name:
              - is too short
            email:
              - is invalid
    PaymentMethod:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        type:
          type: string
        session_required:
          type: boolean
        source_required:
          type: boolean
      required:
        - id
        - name
        - description
        - type
        - session_required
        - source_required
      x-typelizer: true
    Payment:
      type: object
      properties:
        id:
          type: string
        payment_method_id:
          type: string
        response_code:
          type: string
          nullable: true
        number:
          type: string
        amount:
          type: string
        display_amount:
          type: string
        status:
          type: string
        source_type:
          type: string
          nullable: true
          enum:
            - credit_card
            - store_credit
            - payment_source
        source_id:
          type: string
          nullable: true
        source:
          anyOf:
            - $ref: '#/components/schemas/CreditCard'
            - $ref: '#/components/schemas/StoreCredit'
            - $ref: '#/components/schemas/PaymentSource'
          nullable: true
        payment_method:
          $ref: '#/components/schemas/PaymentMethod'
      required:
        - id
        - payment_method_id
        - response_code
        - number
        - amount
        - display_amount
        - status
        - source_type
        - source_id
        - source
        - payment_method
      x-typelizer: true
    CreditCard:
      type: object
      properties:
        id:
          type: string
        brand:
          type: string
        last4:
          type: string
        month:
          type: number
        year:
          type: number
        name:
          type: string
          nullable: true
        default:
          type: boolean
        gateway_payment_profile_id:
          type: string
          nullable: true
      required:
        - id
        - brand
        - last4
        - month
        - year
        - name
        - default
        - gateway_payment_profile_id
      x-typelizer: true
    StoreCredit:
      type: object
      properties:
        id:
          type: string
        amount:
          type: string
        amount_used:
          type: string
        amount_remaining:
          type: string
        display_amount:
          type: string
        display_amount_used:
          type: string
        display_amount_remaining:
          type: string
        currency:
          type: string
      required:
        - id
        - amount
        - amount_used
        - amount_remaining
        - display_amount
        - display_amount_used
        - display_amount_remaining
        - currency
      x-typelizer: true
    PaymentSource:
      type: object
      properties:
        id:
          type: string
        gateway_payment_profile_id:
          type: string
          nullable: true
      required:
        - id
        - gateway_payment_profile_id
      x-typelizer: true
  securitySchemes:
    api_key:
      type: apiKey
      name: x-spree-api-key
      in: header
      description: Publishable API key for store access
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: JWT token for authenticated customers

````