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

# GET /api/v1/checkout-sessions/:id — Fetch Checkout Session

> GET /api/v1/checkout-sessions/:checkoutSessionId — retrieves a checkout session by ID including payment plan, service, subscriptions, and user details.

Poll this endpoint to check whether a subscriber has completed payment for a given checkout session. The response includes the full session state, associated service and payment plan details, the pre-associated user if one was set, and any subscriptions that were created upon payment completion.

```
GET https://api.retempo.xyz/api/v1/checkout-sessions/:checkoutSessionId
```

## Path Parameters

<ParamField path="checkoutSessionId" type="string" required>
  The unique identifier of the checkout session to retrieve.
</ParamField>

## Response

A successful request returns HTTP `200 OK` with the full checkout session object.

<ResponseField name="checkoutSession" type="object">
  The requested checkout session.

  <Expandable title="checkoutSession fields">
    <ResponseField name="id" type="string">Unique identifier for the checkout session.</ResponseField>
    <ResponseField name="serviceId" type="string">ID of the associated service.</ResponseField>
    <ResponseField name="paymentPlanId" type="string">ID of the associated payment plan.</ResponseField>
    <ResponseField name="userId" type="string | null">ID of the pre-associated user, or `null` if not set.</ResponseField>
    <ResponseField name="status" type="string">Current session status — `PENDING`, `PAID`, `EXPIRED`, or `CANCELLED`.</ResponseField>
    <ResponseField name="expiresAt" type="string | null">Expiry datetime, or `null` if not set.</ResponseField>
    <ResponseField name="createdAt" type="string">ISO 8601 datetime the session was created.</ResponseField>
    <ResponseField name="service" type="object">Nested service object with `id`, `name`, and `status`.</ResponseField>
    <ResponseField name="paymentPlan" type="object">Nested payment plan with `id`, `name`, `amount`, and `currency`.</ResponseField>
    <ResponseField name="user" type="object | null">Nested user object if a `userId` was associated, otherwise `null`.</ResponseField>
    <ResponseField name="subscriptions" type="array">List of subscriptions created when payment was completed. Empty while the session is still `PENDING`.</ResponseField>
  </Expandable>
</ResponseField>

### 200 — Checkout session retrieved

```json theme={null}
{
  "checkoutSession": {
    "id": "clz1checkout789",
    "serviceId": "clz1abc2def3ghi4",
    "paymentPlanId": "clz1plan567",
    "userId": null,
    "status": "PENDING",
    "expiresAt": "2025-06-02T10:00:00.000Z",
    "createdAt": "2025-06-01T10:10:00.000Z",
    "service": {
      "id": "clz1abc2def3ghi4",
      "name": "DataStream Pro",
      "status": "ACTIVE"
    },
    "paymentPlan": {
      "id": "clz1plan567",
      "name": "Pro Monthly",
      "amount": "49.000000",
      "currency": "USDC"
    },
    "user": null,
    "subscriptions": []
  }
}
```

## Example Request

```bash theme={null}
curl https://api.retempo.xyz/api/v1/checkout-sessions/clz1checkout789
```

## Error Codes

| Status          | Message                           | Condition                              |
| --------------- | --------------------------------- | -------------------------------------- |
| `404 Not Found` | `Checkout session was not found.` | No session exists for the provided ID. |

<Tip>
  Check the `subscriptions` array in the response — a non-empty list means payment was completed and a subscription is active.
</Tip>
