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.

Parameters

  • componentsobjectRequired

    Configuration for each component. At least 1 component must be enabled.

  • customerstringRequired

    The ID of an existing customer for which to create the Customer Session.

Returns

Returns a Customer Session object.

POST /v1/customer_sessions
curl https://api.stripe.com/v1/customer_sessions \
-u "sk_test_BQokikJ...2HlWgH4olfQ2sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \
-d customer=cus_PO34b57IOUb83c \
-d "components[pricing_table][enabled]"=true
Response
{
"object": "customer_session",
"client_secret": "_POpxYpmkXdtttYtZQYhrsOJZ2RCQ9kCqqXRU6qrP5c4Jgje",
"components": {
"buy_button": {
"enabled": false
},
"pricing_table": {
"enabled": true
}
},
"customer": "cus_PO34b57IOUb83c",
"expires_at": 1684790027,
"livemode": false
}