Create a session
Creates a checkout session for your account. Pass the returned ID to the Payment SDK. Sessions expire 5 minutes after creation.
Authentication
Section titled “Authentication”Authorization: Bearer <API token>, required.
Query parameters
Section titled “Query parameters”| Name | Type | Required | Description |
|---|---|---|---|
domain |
string | Yes | Host name where the checkout will be displayed, e.g. shop.example.com. Must match the SDK domain option. |
Request
Section titled “Request”curl -X POST "https://api.creditcore.io/api/session?domain=shop.example.com" \ -H "Authorization: Bearer $CREDITCORE_API_TOKEN"const res = await fetch('https://api.creditcore.io/api/session?domain=shop.example.com', { method: 'POST', headers: { Authorization: `Bearer ${process.env.CREDITCORE_API_TOKEN}` },});if (!res.ok) throw new Error(`Session failed: ${res.status}`);const sessionId = await res.text();$ch = curl_init('https://api.creditcore.io/api/session?domain=shop.example.com');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('CREDITCORE_API_TOKEN')],]);$sessionId = curl_exec($ch);String sessionId = restClient.post() .uri("https://api.creditcore.io/api/session?domain={d}", "shop.example.com") .headers(h -> h.setBearerAuth(apiToken)) .retrieve() .body(String.class);Response
Section titled “Response”200 OK, text/plain: the session ID.
3f6c2b8e-1d2a-4c55-9a3e-7b1f0c9d2e41Errors
Section titled “Errors”| Status | Body | Cause |
|---|---|---|
401 |
{"error":"UNAUTHORIZED","status":401} |
Missing or invalid token. |
500 |
Error with domain in session <domain> |
domain is empty or invalid. |