# get\_\_subscriptions\_checkout-session\_{id}

`GET /subscriptions/checkout-session/{id}`

*Get Checkout Session Status*

Retrieve the status and details of a Stripe checkout session by its ID. This endpoint is useful for checking payment status and subscription creation after a user completes the checkout process.

#### Parameters

| Name | In   | Type   | Required | Description                                       |
| ---- | ---- | ------ | -------- | ------------------------------------------------- |
| id   | path | string | true     | Unique identifier for the Stripe checkout session |

#### TypeScript Client Library

```typescript
public getCheckoutSessionStatus = async (id: string): Promise<GetCheckoutSessionStatusResponse> => {
  return this.makeRequest<GetCheckoutSessionStatusResponse>(`subscriptions/checkout-session/${id}`, 'GET', null);
};
```

#### Code Samples

{% tabs %}
{% tab title="Shell" %}

```shell
# You can also use wget
curl -X GET https://backend.flashback.tech/subscriptions/checkout-session/cs_test_1234567890abcdef \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'
```

{% endtab %}

{% tab title="HTTP" %}

```http
GET https://backend.flashback.tech/subscriptions/checkout-session/cs_test_1234567890abcdef HTTP/1.1
Host: localhost:3000
Accept: application/json
Authorization: Bearer {access-token}
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'
};

const sessionId = 'cs_test_1234567890abcdef';
fetch(`https://backend.flashback.tech/subscriptions/checkout-session/${sessionId}`,
{
  method: 'GET',
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer {access-token}'
}

session_id = 'cs_test_1234567890abcdef'
result = RestClient.get "https://backend.flashback.tech/subscriptions/checkout-session/#{session_id}",
  params: {
  }, headers: headers

p JSON.parse(result)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

session_id = 'cs_test_1234567890abcdef'
r = requests.get(f'https://backend.flashback.tech/subscriptions/checkout-session/{session_id}', headers = headers)

print(r.json())
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'Authorization' => 'Bearer {access-token}',
);

$session_id = 'cs_test_1234567890abcdef';
$client = new \GuzzleHttp\Client();

try {
    $response = $client->request('GET',"https://backend.flashback.tech/subscriptions/checkout-session/{$session_id}", array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...
```

{% endtab %}

{% tab title="Java" %}

```java
String sessionId = "cs_test_1234567890abcdef";
URL obj = new URL("https://backend.flashback.tech/subscriptions/checkout-session/" + sessionId);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());
```

{% endtab %}

{% tab title="Go" %}

```go
package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "Authorization": []string{"Bearer {access-token}"},
    }

    sessionId := "cs_test_1234567890abcdef"
    data := bytes.NewBuffer([]byte{})
    req, err := http.NewRequest("GET", "https://backend.flashback.tech/subscriptions/checkout-session/" + sessionId, data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}
```

{% endtab %}
{% endtabs %}

> Example responses

> 200 Response

```json
{
  "success": true,
  "id": "cs_test_1234567890abcdef",
  "status": "complete",
  "payment_status": "paid",
  "subscriptionId": "sub_1234567890abcdef"
}
```

> 200 Response (Open Session)

```json
{
  "success": true,
  "id": "cs_test_1234567890abcdef",
  "status": "open",
  "payment_status": "unpaid",
  "subscriptionId": null
}
```

> 200 Response (Expired Session)

```json
{
  "success": true,
  "id": "cs_test_1234567890abcdef",
  "status": "expired",
  "payment_status": "unpaid",
  "subscriptionId": null
}
```

> 400 Response

```json
{
  "success": false,
  "error_code": "INVALID_SESSION",
  "message": "Invalid Checkout Session ID"
}
```

#### Responses <a href="#get__subscriptions_checkout-session_-id-responses" id="get__subscriptions_checkout-session_-id-responses"></a>

| Status | Meaning                                                                         | Description              | Schema |
| ------ | ------------------------------------------------------------------------------- | ------------------------ | ------ |
| 200    | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)                         | Checkout session details | Inline |
| 400    | [Bad Request](https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request) | Invalid session ID       | Inline |

#### Response Schema <a href="#get__subscriptions_checkout-session_-id-responseschema" id="get__subscriptions_checkout-session_-id-responseschema"></a>

Status Code **200**

| Name              | Type    | Required | Restrictions | Description                                          |
| ----------------- | ------- | -------- | ------------ | ---------------------------------------------------- |
| » success         | boolean | false    | none         | Indicates if the request was successful              |
| » id              | string  | false    | none         | Stripe checkout session identifier                   |
| » status          | string  | false    | none         | Session status (open, complete, expired)             |
| » payment\_status | string  | false    | none         | Payment status (unpaid, paid, no\_payment\_required) |
| » subscriptionId  | string  | false    | none         | Stripe subscription ID (null if not created)         |

Status Code **400**

| Name          | Type    | Required | Restrictions | Description                       |
| ------------- | ------- | -------- | ------------ | --------------------------------- |
| » success     | boolean | false    | none         | Will be false for error responses |
| » error\_code | string  | false    | none         | Machine-readable error code       |
| » message     | string  | false    | none         | Human-readable error message      |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flashback.tech/support-reference/platform-api-reference/subscriptions/get__subscriptions_checkout-session_-id.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
