curl --request POST \
--url https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_number": "ORDER-62642"
}
'import requests
url = "https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge"
payload = { "order_number": "ORDER-62642" }
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({order_number: 'ORDER-62642'})
};
fetch('https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge', 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/{id}/charge",
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([
'order_number' => 'ORDER-62642'
]),
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/{id}/charge"
payload := strings.NewReader("{\n \"order_number\": \"ORDER-62642\"\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/{id}/charge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_number\": \"ORDER-62642\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge")
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 \"order_number\": \"ORDER-62642\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cff8784e5eb28b9b04860",
"voucher_id": "cff8784e34b28b9b04860",
"client_id": "cff8784e5eb28b81ca02a",
"type": "charge",
"amount": "10.53",
"order_number": "ORDER-62642",
"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"
}
]
}Charge a specific voucher reservation
Charges the previously created temporary reservation on a voucher.
curl --request POST \
--url https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"order_number": "ORDER-62642"
}
'import requests
url = "https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge"
payload = { "order_number": "ORDER-62642" }
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({order_number: 'ORDER-62642'})
};
fetch('https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge', 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/{id}/charge",
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([
'order_number' => 'ORDER-62642'
]),
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/{id}/charge"
payload := strings.NewReader("{\n \"order_number\": \"ORDER-62642\"\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/{id}/charge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"order_number\": \"ORDER-62642\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vouchers.api.jtl-software.com/v1/reservations/{id}/charge")
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 \"order_number\": \"ORDER-62642\"\n}"
response = http.request(request)
puts response.read_body{
"id": "cff8784e5eb28b9b04860",
"voucher_id": "cff8784e34b28b9b04860",
"client_id": "cff8784e5eb28b81ca02a",
"type": "charge",
"amount": "10.53",
"order_number": "ORDER-62642",
"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.
Path Parameters
Body
Voucher charge request body
Order or invoice number of the transaction for this usage
"ORDER-62642"
Response
OK
Primary identification key - will be used in voucher-charge calls
"cff8784e5eb28b9b04860"
Voucher primary identification key (see voucher -> id)
"cff8784e34b28b9b04860"
Client primary identification key (see client -> id)
"cff8784e5eb28b81ca02a"
Type of this charge. Can either be "charge", "recharge" or "refund"
charge, recharge, refund "charge"
Amount in the currency of this voucher. Must be send as string in the following pattern:
- Up to five digits before the decimal point
- The decimal point (.)
- Exactly two digits after the decimal point
4 - 9^\d+\.\d{2}$"10.53"
Order or invoice number of the transaction
"ORDER-62642"
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?