Create Tokens
Request a token session
Create a session to start Commerce Tokenization using our SDK.
POST
/
tokens
/
session
Request a token session
curl --request POST \
--url https://sandbox.hellgate.io/tokens/session \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"bypass_identification": false,
"expiration_time": 3600
}
'import requests
url = "https://sandbox.hellgate.io/tokens/session"
payload = {
"bypass_identification": False,
"expiration_time": 3600
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({bypass_identification: false, expiration_time: 3600})
};
fetch('https://sandbox.hellgate.io/tokens/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://sandbox.hellgate.io/tokens/session",
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([
'bypass_identification' => false,
'expiration_time' => 3600
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://sandbox.hellgate.io/tokens/session"
payload := strings.NewReader("{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://sandbox.hellgate.io/tokens/session")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hellgate.io/tokens/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}"
response = http.request(request)
puts response.read_body{
"session_id": "0f2c8f7e-4d2a-4d1b-9a6e-1c9b2d3e4f50"
}{
"code": 401,
"message": "No valid means of authentication was provided",
"classifier": "UNAUTHORIZED"
}{
"code": 403,
"message": "Not allowed to access this resource or feature",
"classifier": "FORBIDDEN"
}Authorizations
Body
application/json
Skips ID&V during tokenization if set to true
The expiry time is used to specify after how many seconds a Commerce token should be automatically deleted.
This type of tokens is useful for short-lived operations (guest checkout) that require a token to be used only once or for a limited time. Information: If a token is created with an expiration time, no network-token will be provisioned.
Required range:
1 <= x <= 2592000Example:
3600
Response
Success response (Created)
The ID of the session which needs to be used to initialize the SDK.
Example:
"0f2c8f7e-4d2a-4d1b-9a6e-1c9b2d3e4f50"
⌘I
Request a token session
curl --request POST \
--url https://sandbox.hellgate.io/tokens/session \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"bypass_identification": false,
"expiration_time": 3600
}
'import requests
url = "https://sandbox.hellgate.io/tokens/session"
payload = {
"bypass_identification": False,
"expiration_time": 3600
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({bypass_identification: false, expiration_time: 3600})
};
fetch('https://sandbox.hellgate.io/tokens/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://sandbox.hellgate.io/tokens/session",
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([
'bypass_identification' => false,
'expiration_time' => 3600
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://sandbox.hellgate.io/tokens/session"
payload := strings.NewReader("{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://sandbox.hellgate.io/tokens/session")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hellgate.io/tokens/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bypass_identification\": false,\n \"expiration_time\": 3600\n}"
response = http.request(request)
puts response.read_body{
"session_id": "0f2c8f7e-4d2a-4d1b-9a6e-1c9b2d3e4f50"
}{
"code": 401,
"message": "No valid means of authentication was provided",
"classifier": "UNAUTHORIZED"
}{
"code": 403,
"message": "Not allowed to access this resource or feature",
"classifier": "FORBIDDEN"
}