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

# Retrieve Checkout Session

> Retrieve an existing checkout session by its unique identifier

<Note>
  This endpoint retrieves the current state of a checkout session, including all items, totals, fulfillment options, and status information.
</Note>

## Authentication

This endpoint requires a valid API key with `checkouts:read` permissions.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="id" type="string" required>
  Unique identifier for the checkout session
</ParamField>

### Response

<ResponseField name="id" type="string">
  Unique identifier for the Checkout Session
</ResponseField>

<ResponseField name="buyer" type="object">
  Information about the buyer
</ResponseField>

<ResponseField name="payment_provider" type="object">
  Payment provider configuration and supported payment methods
</ResponseField>

<ResponseField name="status" type="string">
  Current status: `not_ready_for_payment`, `ready_for_payment`, `completed`, `canceled`, `in_progress`
</ResponseField>

<ResponseField name="currency" type="string">
  Three-letter ISO currency code in lowercase
</ResponseField>

<ResponseField name="line_items" type="array">
  Array of line items in the checkout with calculated amounts
</ResponseField>

<ResponseField name="fulfillment_address" type="object">
  Address where the order will ship
</ResponseField>

<ResponseField name="fulfillment_options" type="array">
  Available shipping and fulfillment options
</ResponseField>

<ResponseField name="fulfillment_option_id" type="string">
  ID of the currently selected fulfillment option
</ResponseField>

<ResponseField name="totals" type="array">
  Breakdown of charges including subtotal, tax, shipping, and total
</ResponseField>

<ResponseField name="messages" type="array">
  Array of messages or notifications related to the checkout
</ResponseField>

<ResponseField name="links" type="array">
  Array of links related to policies and agreements
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.stateset.com/v1/checkouts/checkout_abc123 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const checkout = await stateset.checkouts.retrieve('checkout_abc123');
  ```

  ```python Python theme={null}
  checkout = stateset.checkouts.retrieve('checkout_abc123')
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "id": "checkout_abc123",
    "buyer": {
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@example.com",
      "phone_number": "+1234567890"
    },
    "payment_provider": {
      "provider": "stripe",
      "supported_payment_methods": ["card"]
    },
    "status": "ready_for_payment",
    "currency": "usd",
    "line_items": [
      {
        "id": "item_123",
        "item": {
          "id": "item_123",
          "quantity": 2
        },
        "base_amount": 2000,
        "discount": 0,
        "total": 2000,
        "subtotal": 2000,
        "tax": 0
      }
    ],
    "fulfillment_address": {
      "name": "John Doe",
      "line_one": "123 Main St",
      "line_two": "Apt 4B",
      "city": "San Francisco",
      "state": "CA",
      "country": "US",
      "postal_code": "94105"
    },
    "fulfillment_options": [
      {
        "type": "shipping",
        "id": "shipping_fast",
        "title": "Express Shipping",
        "subtitle": "2-3 business days",
        "carrier": "Shipping Co",
        "subtotal": 150,
        "tax": 0,
        "total": 150
      }
    ],
    "fulfillment_option_id": "shipping_fast",
    "totals": [
      {
        "type": "subtotal",
        "display_text": "Subtotal",
        "amount": 2000
      },
      {
        "type": "fulfillment",
        "display_text": "Shipping",
        "amount": 150
      },
      {
        "type": "tax",
        "display_text": "Tax",
        "amount": 100
      },
      {
        "type": "total",
        "display_text": "Total",
        "amount": 2250
      }
    ],
    "messages": [],
    "links": []
  }
  ```

  ```json Error Response - Not Found theme={null}
  {
    "success": false,
    "error": {
      "type": "invalid_request",
      "code": "RESOURCE_NOT_FOUND",
      "message": "Checkout session not found",
      "param": "id"
    }
  }
  ```
</ResponseExample>
