Movatterモバイル変換


[0]ホーム

URL:


Customer Session

A Customer Session allows you to grant Stripe’s frontend SDKs (like Stripe.js) client-side access control over a Customer.

Related guides:Customer Session with the Payment Element,Customer Session with the Pricing Table,Customer Session with the Buy Button.

The Customer Session object

Attributes

  • client_secretstring

    The client secret of this Customer Session. Used on the client to set up secure access to the givencustomer.

    The client secret can be used to provide access tocustomer from your frontend. It should not be stored, logged, or exposed to anyone other than the relevant customer. Make sure that you have TLS enabled on any page that includes the client secret.

  • componentsobject

    This hash defines which component is enabled and the features it supports.

  • customerstringExpandable

    The Customer the Customer Session was created for.

  • expires_attimestamp

    The timestamp at which this Customer Session will expire.

More attributes

  • objectstring

  • createdtimestamp

  • customer_accountnullable string

  • livemodeboolean

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

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.

  • customerstring

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

More parameters

  • customer_accountstring

Returns

Returns a Customer Session object.

POST /v1/customer_sessions
curl https://api.stripe.com/v1/customer_sessions \
-u"sk_test_09l3shT...CzzZZsiLl2vAsk_test_09l3shTSTKHYCzzZZsiLl2vA:" \
-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
}

[8]ページ先頭

©2009-2026 Movatter.jp