Create an order checkout session
curl --request POST \
--url https://api.tilta.io/v1/orders/{external_id}/sessions/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"success_url": "<string>",
"error_url": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({success_url: '<string>', error_url: '<string>'})
};
fetch('https://api.tilta.io/v1/orders/{external_id}/sessions/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tilta.io/v1/orders/{external_id}/sessions/checkout"
payload = {
"success_url": "<string>",
"error_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tilta.io/v1/orders/{external_id}/sessions/checkout",
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([
'success_url' => '<string>',
'error_url' => '<string>'
]),
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;
}{
"token": "<string>",
"url": "<string>"
}{
"code": "BAD_REQUEST",
"error": "Request validation failed. 1 issue found.",
"issues": [
{
"code": "INVALID_TYPE",
"path": "body.registered_at",
"message": "Invalid type"
}
]
}{
"error": "Unauthorized",
"code": "UNAUTHORIZED"
}{
"error": "No Entity found",
"code": "NOT_FOUND"
}Orders
Create a checkout session
Generate a short-lived JWT token and hosted checkout URL for a draft order. Use the token with the Tilta JS SDK or redirect the buyer to the URL.
POST
/
v1
/
orders
/
{external_id}
/
sessions
/
checkout
Create an order checkout session
curl --request POST \
--url https://api.tilta.io/v1/orders/{external_id}/sessions/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"success_url": "<string>",
"error_url": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({success_url: '<string>', error_url: '<string>'})
};
fetch('https://api.tilta.io/v1/orders/{external_id}/sessions/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.tilta.io/v1/orders/{external_id}/sessions/checkout"
payload = {
"success_url": "<string>",
"error_url": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tilta.io/v1/orders/{external_id}/sessions/checkout",
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([
'success_url' => '<string>',
'error_url' => '<string>'
]),
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;
}{
"token": "<string>",
"url": "<string>"
}{
"code": "BAD_REQUEST",
"error": "Request validation failed. 1 issue found.",
"issues": [
{
"code": "INVALID_TYPE",
"path": "body.registered_at",
"message": "Invalid type"
}
]
}{
"error": "Unauthorized",
"code": "UNAUTHORIZED"
}{
"error": "No Entity found",
"code": "NOT_FOUND"
}Once you have created a draft order, use this endpoint to generate a checkout session that lets the buyer complete the order details – including selecting a payment term and confirming the purchase amount – within Tilta’s hosted checkout UI. The response provides both a short-lived JWT token (for embedding the checkout flow via the Tilta JS SDK) and a pre-built hosted URL (for a full-page redirect). The session is scoped to the specific draft order and expires shortly after creation, so generate it only when you are ready to redirect the buyer.
Checkout sessions are single-use and short-lived. Do not cache the
token or url across page loads – call this endpoint
fresh each time a buyer is about to enter the checkout flow.When using the hosted URL redirect approach, listen for the
ORDER.CONFIRMED webhook event to know when the buyer has
completed the draft order and it is ready for invoicing.Authorizations
Your Tilta API key, sent as Bearer <key>.
Path Parameters
Unique identifier of an order.
Maximum string length:
100Pattern:
^[a-zA-Z0-9-_]+$