Initiate Session
curl --request POST \
--url https://dashu.sa/api/external/initiateSession \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"data": {},
"test": true
}
'import requests
url = "https://dashu.sa/api/external/initiateSession"
payload = {
"apiKey": "<string>",
"data": {},
"test": True
}
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({apiKey: '<string>', data: {}, test: true})
};
fetch('https://dashu.sa/api/external/initiateSession', 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://dashu.sa/api/external/initiateSession",
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([
'apiKey' => '<string>',
'data' => [
],
'test' => true
]),
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://dashu.sa/api/external/initiateSession"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\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://dashu.sa/api/external/initiateSession")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dashu.sa/api/external/initiateSession")
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 \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\n}"
response = http.request(request)
puts response.read_body{
"SessionId": "e09da666-398d-4f0e-bc02-01346d9e3258",
"CountryCode": "KWT",
"CustomerTokens": []
}
{
"success": false,
"code": 1,
"message": "Missing or invalid api key"
}
Embedded Integration
Initiate Session
Initiate new session for a payment. This endpoint will help you get the SessionId that will be used to execute the payment later.
POST
/
initiateSession
Initiate Session
curl --request POST \
--url https://dashu.sa/api/external/initiateSession \
--header 'Content-Type: application/json' \
--data '
{
"apiKey": "<string>",
"data": {},
"test": true
}
'import requests
url = "https://dashu.sa/api/external/initiateSession"
payload = {
"apiKey": "<string>",
"data": {},
"test": True
}
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({apiKey: '<string>', data: {}, test: true})
};
fetch('https://dashu.sa/api/external/initiateSession', 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://dashu.sa/api/external/initiateSession",
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([
'apiKey' => '<string>',
'data' => [
],
'test' => true
]),
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://dashu.sa/api/external/initiateSession"
payload := strings.NewReader("{\n \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\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://dashu.sa/api/external/initiateSession")
.header("Content-Type", "application/json")
.body("{\n \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dashu.sa/api/external/initiateSession")
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 \"apiKey\": \"<string>\",\n \"data\": {},\n \"test\": true\n}"
response = http.request(request)
puts response.read_body{
"SessionId": "e09da666-398d-4f0e-bc02-01346d9e3258",
"CountryCode": "KWT",
"CustomerTokens": []
}
{
"success": false,
"code": 1,
"message": "Missing or invalid api key"
}
Query Parameters
string
required
The API Key of your account.
object
required
Hide properties
Hide properties
string|integer
A unique value represent the customer (your user).Samples:
"UID123", "123", or 123.boolean
Set this property to
true to send the request to the development
environment.{
"SessionId": "e09da666-398d-4f0e-bc02-01346d9e3258",
"CountryCode": "KWT",
"CustomerTokens": []
}
{
"success": false,
"code": 1,
"message": "Missing or invalid api key"
}
Response properties
string
required
The created session identifier.
string
required
The country code (depends on your account)
Error Codes
Here’s a list of possible error codes of this endpoint.| Code | Description |
|---|---|
| 1 | Missing or invalid api key |
| 2 | CustomerIdentifier is a required parameter. |
⌘I