Create a client session
Changed onCreating 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.
Request
- Base URLhttps://api.sandbox.primer.io
- URLhttps://api.sandbox.primer.io/client-session
- AuthAPI key in header X-API-KEY
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
- breaking
removed the enum value
MROof the request property - breaking
removed the enum value
XAGof the request property - breaking
removed the enum value
XAUof the request property - breaking
removed the enum value
XBAof the request property - breaking
removed the enum value
XBBof the request property - breaking
removed the enum value
XBCof the request property - breaking
removed the enum value
XBDof the request property - breaking
removed the enum value
XDRof the request property - breaking
removed the enum value
XFUof the request property - breaking
removed the enum value
XPDof the request property - breaking
removed the enum value
XPTof the request property - breaking
removed the enum value
XSUof the request property - breaking
removed the enum value
XTSof the request property - breaking
removed the enum value
XUAof the request property - breaking
the
response's property type changed fromobjecttoarrayfor status - breaking
removed the required property
/from the response with the status - breaking
removed the required property
/from the response with the status - breaking
removed the required property
/from the response with the status - warning
added the new
EFTPOSenum value to the//response property for the response status - info
added the new optional request property
- info
added the new
EFTPOSenum value to the request property// - info
added the new
SLEenum value to the request property - info
added the new
STNenum value to the request property - info
added the new
VEDenum value to the request property - info
added the new
VESenum value to the request property - info
added the new
XCGenum value to the request property - info
added the new
ZWGenum value to the request property - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status
- breaking