Customer Sessions
Learn more about the Customer Session resource
A customer session resource allows you to configure the user experience of your customer with saved payment methods feature in PayRexJS. This is also a required resource to render the saved payment methods within PayRexJS.
Endpoints
| Endpoint | Name |
|---|---|
| POST /customer_sesions | Create customer session endpoint |
The Customer Resource Resource
{
"id": "cus_s_gtm5b3w7yh8nier7p3Y2vqZizVjdi8zn",
"resource": "customer_session",
"customer": {
"id": "cus_zhDdRn455mzPWaHTpmpjhoLDuzYd597n"
},
"client_secret": "cus_s_gtm5b3w7yh8nier7p3Y2vqZizVjdi8zn_secret_et983B3ocU8mWPSjK6M3XvyzZHUd8Qfn",
"livemode": true,
"components": [
{
"component": "payment_element",
"feature": "payment_method_save",
"value": "enabled"
},
{
"component": "payment_element",
"feature": "payment_method_edit",
"value": "disabled"
},
{
"component": "payment_element",
"feature": "payment_method_redisplay",
"value": "enabled"
},
{
"component": "payment_element",
"feature": "payment_method_remove",
"value": "enabled"
}
],
"expired": false,
"expired_at": 1780532775,
"created_at": 1780446375,
"updated_at": 1780446375
}
Attributes
id string
Unique identifier for the resource. The prefix is cus_s_.
resource string
Represents the resource's type. The value is customer_session.
customer hash
The customer resource associated to the customer session.
Show child attributes
id string
The customer id resource
client_secret string
The client secret of the customer session used to query the customer session from the client side.
livemode boolean
The value is true if the resource's mode is live or the value is false if the resource mode is test.
See the mode guide for more details.
components array
An array of hash that describes the configuration of the customer session when used within PayRexJS. This holds the expected behavior of the saved payment method feature within PayRexJS.
Show child attributes
components[x].component string
The component where the behavior is applicable. Current possible value is payment_element.
components[x].feature string
The specific behavior of the saved payment method component. Possible values are:
- payment_method_save - allows the customer to save more payment methods through PayRex Elements.
- payment_method_remove - allows the customer to delete existing saved payment methods through PayRex Elements.
- payment_method_redisplay - allows the customer to use a saved payment method to complete a payment through PayRex Elements.
components[x].value string
The status of the feature within a component. Possible values are either enabled or disabled.
expired boolean
A boolean value that describes whether the customer session has already expired or not.
expired_at timestamp
The time at which the resource will expire, and also measured in seconds since the Unix epoch.
created_at timestamp
The time the resource was created and measured in seconds since the Unix epoch.
updated_at timestamp
The time the resource was updated and measured in seconds since the Unix epoch.