Retrieve a client session
curl --request GET \
--url https://api.sandbox.primer.io/client-session \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-VERSION: <x-api-version>'import requests
url = "https://api.sandbox.primer.io/client-session"
headers = {
"X-API-VERSION": "<x-api-version>",
"X-API-KEY": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-API-VERSION': '<x-api-version>', 'X-API-KEY': '<api-key>'}
};
fetch('https://api.sandbox.primer.io/client-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.primer.io/client-session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-VERSION: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.primer.io/client-session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-VERSION", "<x-api-version>")
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.primer.io/client-session")
.header("X-API-VERSION", "<x-api-version>")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.primer.io/client-session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-VERSION"] = '<x-api-version>'
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customerId": "customer-123",
"orderId": "order-abc",
"currencyCode": "GBP",
"amount": 650,
"metadata": {
"productType": "Clothing"
},
"customer": {
"emailAddress": "john@primer.io"
},
"order": {
"lineItems": [
{
"itemId": "t-shirt-1",
"description": "White T-Shirt",
"amount": 500,
"quantity": 1
}
],
"fees": [
{
"type": "SURCHARGE",
"amount": 100
}
],
"shipping": {
"amount": 50
},
"paymentMethod": {
"vaultOnSuccess": false,
"vaultOn3DS": false,
"options": {
"GOOGLE_PAY": {
"surcharge": {
"amount": 100
}
},
"PAYMENT_CARD": {
"networks": {
"VISA": {
"surcharge": {
"amount": 10
}
},
"MASTERCARD": {
"surcharge": {
"amount": 20
}
}
}
},
"PAY_NL_IDEAL": {
"surcharge": {
"amount": 50
}
}
}
},
"authorizationType": "ESTIMATED"
}
}{
"error": {
"errorId": "<string>",
"description": "<string>",
"recoverySuggestion": "<string>",
"diagnosticsId": "<string>",
"validationErrors": [
{}
],
"paymentId": "<string>",
"paymentStatus": "<string>"
}
}{
"error": {
"errorId": "<string>",
"description": "<string>",
"recoverySuggestion": "<string>",
"diagnosticsId": "<string>",
"validationErrors": [
{}
]
}
}Retrieve a client session
This API call retrieves all the details associated with the client session corresponding to the client token that is provided in the request. The fields with empty values are excluded from the response.
GET
/
client-session
Retrieve a client session
curl --request GET \
--url https://api.sandbox.primer.io/client-session \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-VERSION: <x-api-version>'import requests
url = "https://api.sandbox.primer.io/client-session"
headers = {
"X-API-VERSION": "<x-api-version>",
"X-API-KEY": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-API-VERSION': '<x-api-version>', 'X-API-KEY': '<api-key>'}
};
fetch('https://api.sandbox.primer.io/client-session', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.primer.io/client-session",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-VERSION: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.primer.io/client-session"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-VERSION", "<x-api-version>")
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.primer.io/client-session")
.header("X-API-VERSION", "<x-api-version>")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.primer.io/client-session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-VERSION"] = '<x-api-version>'
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customerId": "customer-123",
"orderId": "order-abc",
"currencyCode": "GBP",
"amount": 650,
"metadata": {
"productType": "Clothing"
},
"customer": {
"emailAddress": "john@primer.io"
},
"order": {
"lineItems": [
{
"itemId": "t-shirt-1",
"description": "White T-Shirt",
"amount": 500,
"quantity": 1
}
],
"fees": [
{
"type": "SURCHARGE",
"amount": 100
}
],
"shipping": {
"amount": 50
},
"paymentMethod": {
"vaultOnSuccess": false,
"vaultOn3DS": false,
"options": {
"GOOGLE_PAY": {
"surcharge": {
"amount": 100
}
},
"PAYMENT_CARD": {
"networks": {
"VISA": {
"surcharge": {
"amount": 10
}
},
"MASTERCARD": {
"surcharge": {
"amount": 20
}
}
}
},
"PAY_NL_IDEAL": {
"surcharge": {
"amount": 50
}
}
}
},
"authorizationType": "ESTIMATED"
}
}{
"error": {
"errorId": "<string>",
"description": "<string>",
"recoverySuggestion": "<string>",
"diagnosticsId": "<string>",
"validationErrors": [
{}
],
"paymentId": "<string>",
"paymentStatus": "<string>"
}
}{
"error": {
"errorId": "<string>",
"description": "<string>",
"recoverySuggestion": "<string>",
"diagnosticsId": "<string>",
"validationErrors": [
{}
]
}
}Headers
Response
Successful Response
The 3-letter currency code in ISO 4217 format. e.g. use USD for US dollars.
Available options:
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYR, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLP, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MKD, MMK, MNT, MOP, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VED, VES, VND, VUV, WST, XAF, XCD, XCG, XOF, XPF, YER, ZAR, ZMW, ZWG, ZWL The ordered list of card networks accepted for this client session, as resolved from paymentMethod.orderedAllowedCardNetworks and the default list.
The list of available card networks.
Available options:
AMEX, DANKORT, DINERS_CLUB, DISCOVER, EFTPOS, ENROUTE, ELO, HIPER, INTERAC, JCB, MAESTRO, MASTERCARD, MIR, PRIVATE_LABEL, UNIONPAY, VISA, CARTES_BANCAIRES, OTHER