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

# How to Create Checkout Session

> Learn how to create checkout sessions via API.

## Creating a checkout session using the API

<Steps>
  <Step title="Create a New Token">
    Create a new organization token by following our [Organization Access Tokens](https://polar.sh/docs/integrate/oat) guide.
  </Step>

  <Step title="Save your Access Token">
    After creating your access token, you will be able to view it. Please copy and save your access token.

    <img height="200" src="https://mintcdn.com/polar/C5Fvr5TyCIop5r-p/assets/guides/theme-switch-in-checkout/access-token.png?fit=max&auto=format&n=C5Fvr5TyCIop5r-p&q=85&s=05fafce5da35f0a91784fc4b20c3cdf3" data-path="assets/guides/theme-switch-in-checkout/access-token.png" />
  </Step>

  <Step title="Go to the Products Catalogue">
    In the Polar dashboard sidebar, navigate to **Products** > **Catalogue** for your organization.
    You can also go directly to:\
    `https://polar.sh/dashboard/${org_slug}/products`

    <img height="200" src="https://mintcdn.com/polar/C5Fvr5TyCIop5r-p/assets/guides/theme-switch-in-checkout/products-catalogue.png?fit=max&auto=format&n=C5Fvr5TyCIop5r-p&q=85&s=628d916b10c27aaecdb0565bf5230851" data-path="assets/guides/theme-switch-in-checkout/products-catalogue.png" />
  </Step>

  <Step title="Access the product IDs for checkout">
    Retrieve the Product IDs for the items you wish to include in checkout by clicking on the **⋮ (More options) menu** next to chosen products and selecting **Copy Product ID**.\
    These IDs will be required in the next step to create a checkout session.

    <img height="200" src="https://mintcdn.com/polar/C5Fvr5TyCIop5r-p/assets/guides/theme-switch-in-checkout/product-id.png?fit=max&auto=format&n=C5Fvr5TyCIop5r-p&q=85&s=f2ebcca1da24b5ca23a3082f6e60ba77" data-path="assets/guides/theme-switch-in-checkout/product-id.png" />
  </Step>

  <Step title="Create a Checkout Session using the API">
    Open your terminal and paste the following curl command to make an API call for creating a checkout session.
    Be sure to replace:

    * \<YOUR\_ACCESS\_TOKEN> with your actual access token
    * \<PRODUCT\_ID\_1>, \<PRODUCT\_ID\_2>, etc., with the product IDs you want to include in the session

    ```bash Terminal theme={null}
    curl --request POST \
        --url https://api.polar.sh/v1/checkouts/ \
        --header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
        --header 'Content-Type: application/json' \
        --data '{
        "products": [
            "<Product_ID_1>",
            "<Product_ID_2>",
            "<Product_ID_3>"
        ]
    }'
    ```

    Find the description of all the parameters in the [Create Checkout Session API](https://polar.sh/docs/api-reference/checkouts/create-session).
  </Step>

  <Step title="Access the Checkout Session URL">
    The curl command returns a JSON. Access the checkout URL from the <code>"url"</code> key of the JSON.

    ```json theme={null}
    {
        "...": "...",
        "url": "https://buy.polar.sh/polar_c_...", // [!code ++]
        "...": "..."
    }
    ```
  </Step>
</Steps>
