API reference
Customer Sessions
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.
https://api.knoxapi.comCreate a Customer Session
POST/v1/customer_sessions
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.
Body parameters
componentsobjectRequiredConfiguration for each component. At least 1 component must be enabled.
Show 7 child parameters
active_entitlementsobjectShow 1 child parameter
enabledbooleanRequired
buy_buttonobjectShow 1 child parameter
enabledbooleanRequired
customer_portalobjectShow 1 child parameter
enabledbooleanRequired
customer_sheetobjectShow 2 child parameters
enabledbooleanRequiredfeaturesobjectChild parameters are listed in the OpenAPI document.
mobile_payment_elementobjectShow 2 child parameters
enabledbooleanRequiredfeaturesobjectChild parameters are listed in the OpenAPI document.
payment_elementobjectShow 2 child parameters
enabledbooleanRequiredfeaturesobjectChild parameters are listed in the OpenAPI document.
pricing_tableobjectShow 1 child parameter
enabledbooleanRequired
customerstringThe ID of an existing customer for which to create the Customer Session.
customer_accountstringThe ID of an existing Account for which to create the Customer Session.
expandarray of stringsSpecifies which fields in the response should be expanded.
Returns
The customer_session object.
curl https://api.knoxapi.com/v1/customer_sessions \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d components=const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const response = await stripe.rawRequest('POST', '/v1/customer_sessions', {
components: {},
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
response = client.raw_request("post", "/v1/customer_sessions", components={})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
response = Stripe.raw_request(:post, '/v1/customer_sessions', {
components: {},
}){
"client_secret": "cuss_secret_QXhWeUEtZoDV8FHnNbPiBHmAkXKnqYLGMGq7LLf8ODSQ8gL",
"components": {
"buy_button": {
"enabled": false
},
"payment_element": {
"enabled": false,
"features": {
"payment_method_allow_redisplay_filters": [
"unspecified"
],
"payment_method_redisplay": "disabled",
"payment_method_redisplay_limit": null,
"payment_method_remove": "enabled",
"payment_method_save": "disabled",
"payment_method_save_usage": null
}
},
"pricing_table": {
"enabled": true
},
"customer_sheet": {
"enabled": true,
"features": {
"payment_method_allow_redisplay_filters": null,
"payment_method_remove": null
}
},
"mobile_payment_element": {
"enabled": true,
"features": {
"payment_method_allow_redisplay_filters": null,
"payment_method_redisplay": null,
"payment_method_remove": null,
"payment_method_save": null,
"payment_method_save_allow_redisplay_override": null
}
},
"customer_portal": {
"enabled": true
},
"active_entitlements": {
"enabled": true
}
},
"created": 1234567890,
"customer": "cus_QXg1o8vcGmoR32",
"expires_at": 1234567890,
"livemode": false,
"object": "customer_session",
"customer_account": null
}Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.