clientToken
, a temporary key used to initialize Universal 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 Universal Checkout.
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, Universal 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:Field | Description |
---|---|
orderId | Your reference for the payment. Make sure to keep track of orderId - you will later receive updates to the payment via Webhooks. The payment will contain the orderId specified in the client session. |
currencyCode | The three-letter currency code in ISO 4217 format. e.g. use USD for US dollars. |
order.lineItems | The details of the line items of the order. |
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.
BASH
JSON
️
As a
clientToken
is a temporary key, it has an expiration time of 24 hours.Update a client session
Universal 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
refreshClientSession()
to ask Universal Checkout to get the latest client session.
With Drop-in Checkout:
Typescript
Typescript