> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.paymentkit.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paymentkit.com/_mcp/server.

# Get Checkout Session

GET https://app.paymentkit.com/api/{account_id}/checkout-sessions/{external_id}

Get checkout session by ID (authenticated).

Works for both User and API Key authentication.
Account access is automatically validated via endpoint dependency.

Pass `expand=custom_fields` to include the session's custom fields.

Reference: https://docs.paymentkit.com/api-reference/api-reference/checkout-sessions/get-checkout-session

## Authentication

- `Authorization` header (bearer token, required)

## Servers

- `https://app.paymentkit.com` (Production, default)
- `https://staging.paymentkit.com` (Staging)

## Request

### Path parameters

- `external_id` (string, required)
- `account_id` (string, required)

### Query parameters

- `expand` (list of string, optional, nullable)

## Response

### 200

Successful Response

- `id` (string, required) — Unique checkout session identifier
- `account_id` (string, required) — Account identifier
- `secure_token` (string, required) — Secure token for accessing the checkout session
- `expires_in_hours` (integer, required) — Number of hours until the checkout session expires
- `completed` (boolean, required) — Whether the checkout session has been completed
- `state` (enum, required) — Computed state of the checkout session
  - Allowed values: `open`, `success`, `expired`
- `is_expired` (boolean, required) — Whether the checkout session has expired
- `success_url` (string, required) — URL to redirect to on success
- `return_url` (string, required) — URL to return to on cancellation
- `card_tokenization_mode` (enum, required) — Card tokenization mode: 'direct' (KMS encryption) or 'vgs' (VGS Collect + proxy)
  - Allowed values: `direct`, `vgs`
- `created_at` (datetime, required) — When the checkout session was created
- `updated_at` (datetime, required) — When the checkout session was last updated
- `customer_id` (string, optional, nullable) — Customer identifier
- `customer_email` (string, optional, nullable) — Customer email address
- `line_items` (list of object, optional) — List of line items in the checkout session
  - `id` (string, required) — Unique line item identifier
  - `product_id` (string, required) — Product Identifier
  - `price_id` (string, required) — Price Identifier
  - `quantity` (integer, required) — Quantity of items
  - `created_at` (datetime, required) — When the line item was created
  - `updated_at` (datetime, required) — When the line item was last updated
  - `description` (string, optional, nullable) — Line item description
- `coupon_id` (string, optional, nullable) — ID of the coupon applied to this checkout session
- `promotion_code` (string, optional, nullable) — Promotion code used to apply the coupon
- `card_checkout_settings` (object, optional) — Settings for card checkout behavior (parallel setup, 3DS mode)
  - `three_ds_mode` (enum, optional, default: prefer_non_3ds) — How to handle 3DS requirements across processors
    - Allowed values: `prefer_non_3ds`, `first_3ds_wins`
- `cascade_status` (object, optional, nullable) — Cascade pricing status (None if no cascade configured)
  - `total_tiers` (integer, required) — Total number of pricing tiers (1 = primary only, 2+ = has fallbacks)
  - `tier_amounts` (list of integer, required) — Amount in atomic units for each tier (index 0 = primary)
- `cascade_tiers` (list of object, optional, nullable) — Full cascade tier details including processor routes (None if no cascade configured)
  - `line_items` (list of object, required) — Line items for this tier
    - `price_id` (string, required) — Price Identifier
    - `quantity` (integer, optional, default: 1) — Quantity of items
    - `description` (string, optional, nullable) — Line item description
  - `processor_route_id` (string, optional, nullable) — ID of a processor route for this tier. A processor route contains an ordered list of processors tried sequentially as a fallback chain. Set to null to inherit from the session or account default route.
  - `inline_route` (object, optional, nullable) — Define processors directly on this tier instead of referencing a predefined route. The processors are tried in order as a fallback chain. Mutually exclusive with processor_route_id — set one or the other, not both.
    - `processors` (list of object, required) — Ordered list of payment processors to try for this checkout (minimum 1). Each processor is attempted in sequence — if the first fails, the next is tried. Use processor IDs from your account's configured processors (e.g., 'proc_dev_stripe').
      - `processor_id` (string, required) — ID of a payment processor configured on your account. List available processors via the GET /processors endpoint.
    - `name` (string, optional, nullable) — Optional label for this route (e.g., 'Holiday promo routing'). Used for display and logging only — does not affect processing behavior.
    - `description` (string, optional, nullable) — Optional description for this route. Used for display and logging only.
- `processor_route_id` (string, optional, nullable) — ID of the processor route used for card checkout. A processor route contains an ordered list of processors tried sequentially as a fallback chain. This is a single route ID, not an array — to use multiple processors, define them within the route itself.
- `inline_route` (object, optional, nullable) — Inline processor route defined directly on this session. Contains the ordered list of processors to try as a fallback chain. Null if a predefined processor_route_id is used instead, or if no route is configured.
  - `processors` (list of object, required) — Ordered list of payment processors to try for this checkout (minimum 1). Each processor is attempted in sequence — if the first fails, the next is tried. Use processor IDs from your account's configured processors (e.g., 'proc_dev_stripe').
    - `processor_id` (string, required) — ID of a payment processor configured on your account. List available processors via the GET /processors endpoint.
  - `name` (string, optional, nullable) — Optional label for this route (e.g., 'Holiday promo routing'). Used for display and logging only — does not affect processing behavior.
  - `description` (string, optional, nullable) — Optional description for this route. Used for display and logging only.
- `mode` (any, optional) — Checkout session mode
- `setup_preferences` (map from string to any, optional, nullable) — Preferences for payment method setup
- `custom_fields` (map from string to any, optional, nullable) — Custom field values. Only included when expand=custom_fields is specified.
- `params_for_sub` (object, optional, nullable) — Parameters to pass to the subscription when created from this checkout session.
  - `custom_fields` (map from string to any, optional, nullable) — Custom field values validated against subscription field definitions.
- `statement_descriptor_suffix` (string, optional, nullable) — Statement descriptor suffix for this checkout session. Applied to the charge made from this session and copied onto any subscription created from it, so renewals inherit it. Null when not set.

## Examples

**Response**

```json
{
  "id": "cs_dev_x7k9m2n4p8q1",
  "account_id": "acc_dev_x7k9m2n4p8q1",
  "secure_token": "tok_abc123xyz789",
  "expires_in_hours": 24,
  "completed": false,
  "state": "open",
  "is_expired": false,
  "success_url": "https://example.com/success",
  "return_url": "https://example.com/return",
  "card_tokenization_mode": "direct",
  "created_at": "2024-01-15T09:30:00Z",
  "updated_at": "2024-01-15T09:30:00Z",
  "customer_id": "user_dev_x7k9m2n4p8q1",
  "customer_email": "taylor@example.com",
  "line_items": [
    {
      "id": "csli_dev_x7k9m2n4p8q1",
      "product_id": "product_dev_x7k9m2n4",
      "price_id": "price_dev_x7k9m2n4",
      "quantity": 1,
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "description": "Premium subscription plan"
    }
  ],
  "coupon_id": "coupon_dev_x7k9m2n4",
  "promotion_code": "SAVE20",
  "card_checkout_settings": {
    "three_ds_mode": "prefer_non_3ds"
  },
  "cascade_status": {
    "total_tiers": 3,
    "tier_amounts": [
      10000,
      8000,
      5000
    ]
  },
  "cascade_tiers": [
    {
      "line_items": [
        {
          "price_id": "price_dev_x7k9m2n4",
          "quantity": 1,
          "description": "Fallback subscription plan"
        }
      ],
      "processor_route_id": "proute_dev_x7k9m2n4",
      "inline_route": {
        "processors": [
          {
            "processor_id": "proc_dev_stripe"
          }
        ],
        "name": "string",
        "description": "string"
      }
    }
  ],
  "processor_route_id": "proute_dev_x7k9m2n4",
  "inline_route": {
    "processors": [
      {
        "processor_id": "proc_dev_stripe"
      }
    ],
    "name": "string",
    "description": "string"
  },
  "setup_preferences": {},
  "custom_fields": {},
  "params_for_sub": {
    "custom_fields": {}
  },
  "statement_descriptor_suffix": "string"
}
```

**SDK Code**

```python
from payment_kit import PaymentKit

client = PaymentKit(
    token="YOUR_TOKEN_HERE",
)

client.checkout_sessions.get_checkout_session(
    account_id="account_id",
    external_id="external_id",
)

```

```javascript
const url = 'https://app.paymentkit.com/api/account_id/checkout-sessions/external_id';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.paymentkit.com/api/account_id/checkout-sessions/external_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.paymentkit.com/api/account_id/checkout-sessions/external_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.paymentkit.com/api/account_id/checkout-sessions/external_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.paymentkit.com/api/account_id/checkout-sessions/external_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.paymentkit.com/api/account_id/checkout-sessions/external_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/checkout-sessions/external_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```