The Customer Session object
Attributes
object(string) String representing the object’s type. Objects of the same type share the same value.client_secret(string) 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 to
customerfrom 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.components(object) This hash defines which component is enabled and the features it supports.components.buy_button(object) Configuration for buy button.components.buy_button.enabled(boolean) Whether the buy button is enabled.
components.customer_sheet(object) Configuration for the customer sheet.components.customer_sheet.enabled(boolean) Whether the customer sheet is enabled.components.customer_sheet.features(object, nullable) This hash defines whether the customer sheet supports certain features.components.customer_sheet.features.payment_method_allow_redisplay_filters(array of enums, nullable) A list ofallow_redisplayvalues that controls which saved payment methods the customer sheet displays by filtering to only show payment methods with anallow_redisplayvalue that is present in this list.If not specified, defaults to [“always”]. In order to display all saved payment methods, specify [“always”, “limited”, “unspecified”]. Possible enum values:
alwaysUsealwaysto indicate that this payment method can always be shown to a customer in a checkout flow.limitedUselimitedto indicate that this payment method can’t always be shown to a customer in a checkout flow. For example, it can only be shown in the context of a specific subscription.unspecifiedThis is the default value for payment methods whereallow_redisplaywasn’t set.
components.customer_sheet.features.payment_method_remove(enum, nullable) Controls whether the customer sheet displays the option to remove a saved payment method."Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the
customerobject from that PaymentMethod. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.mobile_payment_element(object) Configuration for the mobile payment element.components.mobile_payment_element.enabled(boolean) Whether the mobile payment element is enabled.components.mobile_payment_element.features(object, nullable) This hash defines whether the mobile payment element supports certain features.components.mobile_payment_element.features.payment_method_allow_redisplay_filters(array of enums, nullable) A list ofallow_redisplayvalues that controls which saved payment methods the mobile payment element displays by filtering to only show payment methods with anallow_redisplayvalue that is present in this list.If not specified, defaults to [“always”]. In order to display all saved payment methods, specify [“always”, “limited”, “unspecified”]. Possible enum values:
alwaysUsealwaysto indicate that this payment method can always be shown to a customer in a checkout flow.limitedUselimitedto indicate that this payment method can’t always be shown to a customer in a checkout flow. For example, it can only be shown in the context of a specific subscription.unspecifiedThis is the default value for payment methods whereallow_redisplaywasn’t set.
components.mobile_payment_element.features.payment_method_redisplay(enum, nullable) Controls whether or not the mobile payment element shows saved payment methods. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.mobile_payment_element.features.payment_method_remove(enum, nullable) Controls whether the mobile payment element displays the option to remove a saved payment method."Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the
customerobject from that PaymentMethod. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.mobile_payment_element.features.payment_method_save(enum, nullable) Controls whether the mobile payment element displays a checkbox offering to save a new payment method.If a customer checks the box, the
allow_redisplayvalue on the PaymentMethod is set to'always'at confirmation time. For PaymentIntents, thesetup_future_usagevalue is also set to the value defined inpayment_method_save_usage. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.mobile_payment_element.features.payment_method_save_allow_redisplay_override(enum, nullable) Allows overriding the value of allow_override when saving a new payment method when payment_method_save is set to disabled. Use values: “always”, “limited”, or “unspecified”.If not specified, defaults to
nil(no override value). Possible enum values:alwaysUsealwaysto indicate that this payment method can always be shown to a customer in a checkout flow.limitedUselimitedto indicate that this payment method can’t always be shown to a customer in a checkout flow. For example, it can only be shown in the context of a specific subscription.unspecifiedThis is the default value for payment methods whereallow_redisplaywasn’t set.
components.payment_element(object) Configuration for the Payment Element.components.payment_element.enabled(boolean) Whether the Payment Element is enabled.components.payment_element.features(object, nullable) This hash defines whether the Payment Element supports certain features.components.payment_element.features.payment_method_allow_redisplay_filters(array of enums) A list ofallow_redisplayvalues that controls which saved payment methods the Payment Element displays by filtering to only show payment methods with anallow_redisplayvalue that is present in this list.If not specified, defaults to [“always”]. In order to display all saved payment methods, specify [“always”, “limited”, “unspecified”]. Possible enum values:
alwaysUsealwaysto indicate that this payment method can always be shown to a customer in a checkout flow.limitedUselimitedto indicate that this payment method can’t always be shown to a customer in a checkout flow. For example, it can only be shown in the context of a specific subscription.unspecifiedThis is the default value for payment methods whereallow_redisplaywasn’t set.
components.payment_element.features.payment_method_redisplay(enum) Controls whether or not the Payment Element shows saved payment methods. This parameter defaults todisabled. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.payment_element.features.payment_method_redisplay_limit(integer, nullable) Determines the max number of saved payment methods for the Payment Element to display. This parameter defaults to3. The maximum redisplay limit is10.components.payment_element.features.payment_method_remove(enum) Controls whether the Payment Element displays the option to remove a saved payment method. This parameter defaults todisabled.Allowing buyers to remove their saved payment methods impacts subscriptions that depend on that payment method. Removing the payment method detaches the
customerobject from that PaymentMethod. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.payment_element.features.payment_method_save(enum) Controls whether the Payment Element displays a checkbox offering to save a new payment method. This parameter defaults todisabled.If a customer checks the box, the
allow_redisplayvalue on the PaymentMethod is set to'always'at confirmation time. For PaymentIntents, thesetup_future_usagevalue is also set to the value defined inpayment_method_save_usage. Possible enum values:disabledThe feature is disabled.enabledThe feature is enabled.
components.payment_element.features.payment_method_save_usage(enum, nullable) When using PaymentIntents and the customer checks the save checkbox, this field determines thesetup_future_usagevalue used to confirm the PaymentIntent.When using SetupIntents, directly configure the
usagevalue on SetupIntent creation. Possible enum values:off_sessionUseoff_sessionif your customer may or may not be present in your checkout flow.on_sessionUseon_sessionif you intend to only reuse the payment method when your customer is present in your checkout flow.
components.pricing_table(object) Configuration for the pricing table.components.pricing_table.enabled(boolean) Whether the pricing table is enabled.
created(timestamp) Time at which the object was created. Measured in seconds since the Unix epoch.customer(string, expandable (can be expanded into an object with theexpandrequest parameter)) The Customer the Customer Session was created for.customer_account(string, nullable) The Account that the Customer Session was created for.expires_at(timestamp) The timestamp at which this Customer Session will expire.livemode(boolean) If the object exists in live mode, the value istrue. If the object exists in test mode, the value isfalse.
The Customer Session object
json
{
"object": "customer_session",
"client_secret": "_POpxYpmkXdtttYtZQYhrsOJZ2RCQ9kCqqXRU6qrP5c4Jgje",
"components": {
"buy_button": {
"enabled": false
},
"pricing_table": {
"enabled": true
}
},
"customer": "cus_PO34b57IOUb83c",
"expires_at": 1684790027,
"livemode": false
}