A Payment session is an object representing the lifecycle of a single customer's purchase, starting from signing in or created a new cart up to completing a purchase. The Payment session contains a client secret that can be used to authenticate as the customer from the client device or frontend.
Payment session lifecycle tipWe recommend create one payment session per order or customer session in your system. The id of the payment session can be used as the idempotency key for API operations.
Payment session attributes
| Field | Type | Description | Example value |
|---|---|---|---|
id | string | Unique identifier for the payment session. | 9f656bb4-7e9e-450f-8cf6-647cf029454d |
clientSecret | string | The client secret of this payment session. The client secret is used to authorize Ansa API calls initiated from the client device. | ansa_cs_sandbox_+v1234512345 |
customerId | string | The ID of the Customer this payment session belongs to. | |
created | timestamp | The timestamp (in RFC 3339 format) when the payment session and its associated client secret were created. | 2022-12-08T23:47:41.643Z |
validUntil | timestamp | The timestamp (in RFC 3339 format) when the payment session and its associated client secret will expire. This is typically 24 hours after created. | 2022-12-09T23:47:41.643Z |