curl --request POST \
--url https://vouchers.api.jtl-software.com/v1/reservations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "10.53",
"currency": "EUR",
"code": "test",
"pin": "test"
}
'import requests
url = "https://vouchers.api.jtl-software.com/v1/reservations"
payload = {
"amount": "10.53",
"currency": "EUR",
"code": "test",
"pin": "test"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: '10.53', currency: 'EUR', code: 'test', pin: 'test'})
};
fetch('https://vouchers.api.jtl-software.com/v1/reservations', 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://vouchers.api.jtl-software.com/v1/reservations",
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([
'amount' => '10.53',
'currency' => 'EUR',
'code' => 'test',
'pin' => 'test'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://vouchers.api.jtl-software.com/v1/reservations"
payload := strings.NewReader("{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://vouchers.api.jtl-software.com/v1/reservations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vouchers.api.jtl-software.com/v1/reservations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}"
response = http.request(request)
puts response.read_body{
"id": "da39a3ee5eb28b7392ef5",
"voucher_id": "da39a3ee4528b7392ef5",
"voucher_taxable": false,
"voucher_tax_rate": null,
"client_id": "cff8784e5eb28b9b04860",
"amount": "10.53",
"valid_until": "2017-07-21T17:32:28+00:00",
"created_at": "2017-07-21T17:32:28+00:00",
"updated_at": "2017-07-21T17:32:28+00:00"
}"Forbidden"{
"status": 404,
"code": "VOUCHER.NOT_FOUND",
"message": "The requested Voucher was not found."
}{
"status": 422,
"code": "VOUCHER.CREATE.UNPROCESSABLE_ENTITY",
"message": "The given data was invalid.",
"errors": [
{
"code": "VOUCHER.CREATE.CURRENCY.VALID_CURRENCY",
"property": "currency",
"rule": "valid_currency",
"message": "Currency must be a valid currency code"
}
]
}Set the reservation for a specific voucher
This call temporary reserves an amount on a specific voucher, that can later be charged. A reservation expires after 30 minutes or in case a new one is requested for this voucher.
curl --request POST \
--url https://vouchers.api.jtl-software.com/v1/reservations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "10.53",
"currency": "EUR",
"code": "test",
"pin": "test"
}
'import requests
url = "https://vouchers.api.jtl-software.com/v1/reservations"
payload = {
"amount": "10.53",
"currency": "EUR",
"code": "test",
"pin": "test"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({amount: '10.53', currency: 'EUR', code: 'test', pin: 'test'})
};
fetch('https://vouchers.api.jtl-software.com/v1/reservations', 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://vouchers.api.jtl-software.com/v1/reservations",
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([
'amount' => '10.53',
'currency' => 'EUR',
'code' => 'test',
'pin' => 'test'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://vouchers.api.jtl-software.com/v1/reservations"
payload := strings.NewReader("{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://vouchers.api.jtl-software.com/v1/reservations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vouchers.api.jtl-software.com/v1/reservations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"10.53\",\n \"currency\": \"EUR\",\n \"code\": \"test\",\n \"pin\": \"test\"\n}"
response = http.request(request)
puts response.read_body{
"id": "da39a3ee5eb28b7392ef5",
"voucher_id": "da39a3ee4528b7392ef5",
"voucher_taxable": false,
"voucher_tax_rate": null,
"client_id": "cff8784e5eb28b9b04860",
"amount": "10.53",
"valid_until": "2017-07-21T17:32:28+00:00",
"created_at": "2017-07-21T17:32:28+00:00",
"updated_at": "2017-07-21T17:32:28+00:00"
}"Forbidden"{
"status": 404,
"code": "VOUCHER.NOT_FOUND",
"message": "The requested Voucher was not found."
}{
"status": 422,
"code": "VOUCHER.CREATE.UNPROCESSABLE_ENTITY",
"message": "The given data was invalid.",
"errors": [
{
"code": "VOUCHER.CREATE.CURRENCY.VALID_CURRENCY",
"property": "currency",
"rule": "valid_currency",
"message": "Currency must be a valid currency code"
}
]
}Authorizations
This API uses OAuth 2 with Client Credentials Flow (see: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials).
You can request only a subset of specific scopes for your client, however the available scopes for each client are defined through the client groups in the UI.
Within your token request, you can also send the optional parameter client_type (string with a max length of 32 chars). This value is only used for internal statistics.
Body
Voucher reservation request body
The three-character ISO-4217 currency code - https://en.wikipedia.org/wiki/ISO_4217#Active_codes (must match the currency of the voucher)
3"EUR"
Response
OK
valid_until - datetime in RFC3339 format, see https://tools.ietf.org/html/rfc3339
"2017-07-21T17:32:28+00:00"
created_at - datetime in RFC3339 format, see https://tools.ietf.org/html/rfc3339
"2017-07-21T17:32:28+00:00"
updated_at - datetime in RFC3339 format, see https://tools.ietf.org/html/rfc3339
"2017-07-21T17:32:28+00:00"
Was this page helpful?