Create a client session
Creating a client session generates a client token: a temporary key used to initialize Universal Checkout and authenticate it against your account.
Universal Checkout automatically retrieves all the settings from the client session and the Dashboard to configure the payment methods and the checkout experience.
<b>Note:</b> When creating a Client Session, please make sure to provide currencyCode, orderId, and at least one of amount or lineItems. If any of these are not yet available, you can provide them when making the payment request.
<code>POST /client-session</code> does not have required fields as all fields are not always known when a client session is created. Use <code>PATCH /client-session</code> to update the parameters throughout the checkout session.
Client tokens expire after 24 hours.
Headers
Specifies the version of the API to use. This must be set to 2.4.
Request body
Example request
{
"orderId": "order-abc",
"currencyCode": "GBP",
"amount": 1000,
"order": {
"countryCode": "FR,",
"lineItems": [
{
"itemId": "shoe-123",
"description": "Blue Shoe",
"amount": 100,
"quantity": 10
}
]
},
"customerId": "customer-123",
"customer": {
"emailAddress": "john@primer.io"
},
"metadata": {
"productType": "Shoes"
},
"paymentMethod": {
"descriptor": "Purchase: Shoes",
"paymentMethodType": "PAYMENT_CARD",
"vaultOnSuccess": true,
"vaultOn3DS": false,
"options": {
"PAYMENT_CARD": {
"networks": {
"VISA": {
"surcharge": {
"amount": 10
}
}
}
},
"GOOGLE_PAY": {
"surcharge": {
"amount": 20
}
}
},
"authorizationType": "ESTIMATED"
}
}Response
Successful Response
Example response
{
"clientToken": "client-session-token",
"clientExpirationDate": "2019-08-24T14:15:22Z",
"customerId": "customer-123",
"orderId": "order-abc",
"currencyCode": "GBP",
"metadata": {
"productType": "Shoe"
},
"customer": {
"emailAddress": "john@primer.io"
},
"amount": 20,
"order": {
"countryCode": "FR",
"fees": [
{
"type": "SURCHARGE",
"amount": 20
}
]
},
"paymentMethod": {
"vaultOnSuccess": true,
"vaultOn3DS": false,
"options": {
"PAYMENT_CARD": {
"networks": {
"VISA": {
"surcharge": {
"amount": 10
}
}
},
"captureVaultedCardCvv": true
},
"GOOGLE_PAY": {
"surcharge": {
"amount": 20
}
}
},
"authorizationType": "ESTIMATED"
},
"warnings": [
{
"type": "TAXJAR",
"code": "MISSING_DATA",
"message": "Shipping details are required for calculating tax."
}
]
}Changes
No recorded changes to this endpoint across all 1 revision of this API.