# Create a Customer Session

Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources.

## Prerequisites

Before you can run the following code snippet, you need to call these APIs with the provided parameters to set up the prerequisite API object(s).

1. createCustomer
POST /v1/customers {"name":"Jenny Rosen","email":"jennyrosen@example.com"}

## Request

```curl
curl https://api.stripe.com/v1/customer_sessions \
  -u "<<YOUR_SECRET_KEY>>" \
  -d customer={{CUSTOMER_ID}} \
  -d "components[pricing_table][enabled]=true"
```

### Response

```json
{
  "object": "customer_session",
  "client_secret": "_POpxYpmkXdtttYtZQYhrsOJZ2RCQ9kCqqXRU6qrP5c4Jgje",
  "components": {
    "buy_button": {
      "enabled": false
    },
    "pricing_table": {
      "enabled": true
    }
  },
  "customer": "cus_PO34b57IOUb83c",
  "expires_at": 1684790027,
  "livemode": false
}
```

## Returns

Returns a Customer Session object.

## Parameters

- [`components`](https://docs.stripe.com/api/customer_sessions/create.md?query=components) (object, required)
  Configuration for each component. At least 1 component must be enabled.

- `customer` (string, optional)
  The ID of an existing customer for which to create the Customer Session.

- `customer_account` (string, optional)
  The ID of an existing Account for which to create the Customer Session.
