StartSession
curl --request POST \
--url https://{domain}/api/StartSession \
--header 'Content-Type: application/json' \
--data '
{
"HwSerial": "0434334921100366",
"MachineId": 71234996,
"TokenId": 116383,
"Random": "123456789qwertyui"
}
'import requests
url = "https://{domain}/api/StartSession"
payload = {
"HwSerial": "0434334921100366",
"MachineId": 71234996,
"TokenId": 116383,
"Random": "123456789qwertyui"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
HwSerial: '0434334921100366',
MachineId: 71234996,
TokenId: 116383,
Random: '123456789qwertyui'
})
};
fetch('https://{domain}/api/StartSession', 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://{domain}/api/StartSession",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'HwSerial' => '0434334921100366',
'MachineId' => 71234996,
'TokenId' => 116383,
'Random' => '123456789qwertyui'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/StartSession"
payload := strings.NewReader("{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{domain}/api/StartSession")
.header("Content-Type", "application/json")
.body("{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/StartSession")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}"
response = http.request(request)
puts response.read_body{
"Cipher": "X305dITNTAw2vHsxE+taVcn6UvgBC3fdI6QbqeABgHbo8CKsoZhqISJfslehCiA+L7XYrqvKFci7C6BNj/trzBuNJwBEjgBzKhhgpJ5ggnw=",
"Status": {
"Verdict": "Approved"
}
}Transactions
StartSession
StartSession
curl --request POST \
--url https://{domain}/api/StartSession \
--header 'Content-Type: application/json' \
--data '
{
"HwSerial": "0434334921100366",
"MachineId": 71234996,
"TokenId": 116383,
"Random": "123456789qwertyui"
}
'import requests
url = "https://{domain}/api/StartSession"
payload = {
"HwSerial": "0434334921100366",
"MachineId": 71234996,
"TokenId": 116383,
"Random": "123456789qwertyui"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
HwSerial: '0434334921100366',
MachineId: 71234996,
TokenId: 116383,
Random: '123456789qwertyui'
})
};
fetch('https://{domain}/api/StartSession', 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://{domain}/api/StartSession",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'HwSerial' => '0434334921100366',
'MachineId' => 71234996,
'TokenId' => 116383,
'Random' => '123456789qwertyui'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/StartSession"
payload := strings.NewReader("{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{domain}/api/StartSession")
.header("Content-Type", "application/json")
.body("{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/StartSession")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"HwSerial\": \"0434334921100366\",\n \"MachineId\": 71234996,\n \"TokenId\": 116383,\n \"Random\": \"123456789qwertyui\"\n}"
response = http.request(request)
puts response.read_body{
"Cipher": "X305dITNTAw2vHsxE+taVcn6UvgBC3fdI6QbqeABgHbo8CKsoZhqISJfslehCiA+L7XYrqvKFci7C6BNj/trzBuNJwBEjgBzKhhgpJ5ggnw=",
"Status": {
"Verdict": "Approved"
}
}This is the initial API call sent by Nayax. It initiates the transaction session by authenticating both parties and generating a
SparkTransactionId, which will be echoed in all subsequent calls throughout the transaction’s lifecycle.
Try it: Spark Auth Tool
Build or inspect the
StartSession cipher in your browser, no code required. Opens the tool on the StartSession tab.Body
application/json
The payload to initiate a new session.
The request payload sent by the Spark platform to the integrator's configured StartSession endpoint to initiate a transaction session.
Response
200 - application/json
object | null
Success. A new session has been successfully initiated.
The response payload from the StartSession endpoint, containing encrypted data and the session status.
Was this page helpful?