Skip to main content
A client session is the starting point for integrating payments with the Primer Checkout. You can attach all the metadata associated with the order to the client session, and generate a clientToken, a temporary key used to initialize Primer Checkout. The information you include in the client session is used in the Dashboard:
  • to conditionally route payments with Workflows
  • to activate payment methods and other features in Primer Checkout.
So pass as much information as you can!
The clientToken is a key concept within Primer. You may receive a client token from various places but as long as you pass it to the SDK, Primer Checkout knows where to start/resume the flow.

Create a client session

On your server, create a client session with . Make sure to pass at least the following data: Use the metadata field to attach arbitrary data. Use this to build custom conditions in Workflows for routing and A/B testing.
Data you pass when creating a client session is used when creating a payment, unless explicitly overwritten.
Make sure to pass all the information required by the payment methods and features activated on your Dashboard.
Example request:
BASH
The body of a successful response contains a clientToken that you will use to initialize Primer Checkout. Check the warnings array for missing data which may be required to display certain payment methods and checkout modules in the Primer Checkout.
JSON
️ As a clientToken is a temporary key, it has an expiration time of 24 hours.

Update a client session

Primer Checkout automatically updates the Client Session as it captures more data such as the billing address. Alternatively, you can manually update the Client Session to update the line items or the customer details. Make a request to to update the Client Session tied to a Client Token.
BASH
Then, call refreshClientSession() to ask the Checkout to get the latest client session. With Drop-in Checkout:
Typescript
With Headless Checkout:
Typescript