curl --request POST \
--url https://api.trycarhub.com/mgmt/v1/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price_id": "pack_10k",
"quantity": 1
}
'import requests
url = "https://api.trycarhub.com/mgmt/v1/billing/checkout"
payload = {
"price_id": "pack_10k",
"quantity": 1
}
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({price_id: 'pack_10k', quantity: 1})
};
fetch('https://api.trycarhub.com/mgmt/v1/billing/checkout', 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://api.trycarhub.com/mgmt/v1/billing/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([
'price_id' => 'pack_10k',
'quantity' => 1
]),
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://api.trycarhub.com/mgmt/v1/billing/checkout"
payload := strings.NewReader("{\n \"price_id\": \"pack_10k\",\n \"quantity\": 1\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://api.trycarhub.com/mgmt/v1/billing/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price_id\": \"pack_10k\",\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trycarhub.com/mgmt/v1/billing/checkout")
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 \"price_id\": \"pack_10k\",\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"purchase_id": "pur_a1b2c3d4e5f6g7h8",
"checkout_url": "<string>",
"status": "pending",
"object": "checkout_session"
}Create a Stripe Checkout session
Opens a Checkout session for a credit top-up or a subscription. Credits are granted by the
plan definition (credits on the Stripe Price), never derived from the amount
paid — the same pack may cost €100 here and $120 there for the same credit amount.
Required capability: billing management (owner or billing_manager).
curl --request POST \
--url https://api.trycarhub.com/mgmt/v1/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"price_id": "pack_10k",
"quantity": 1
}
'import requests
url = "https://api.trycarhub.com/mgmt/v1/billing/checkout"
payload = {
"price_id": "pack_10k",
"quantity": 1
}
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({price_id: 'pack_10k', quantity: 1})
};
fetch('https://api.trycarhub.com/mgmt/v1/billing/checkout', 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://api.trycarhub.com/mgmt/v1/billing/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([
'price_id' => 'pack_10k',
'quantity' => 1
]),
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://api.trycarhub.com/mgmt/v1/billing/checkout"
payload := strings.NewReader("{\n \"price_id\": \"pack_10k\",\n \"quantity\": 1\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://api.trycarhub.com/mgmt/v1/billing/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"price_id\": \"pack_10k\",\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trycarhub.com/mgmt/v1/billing/checkout")
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 \"price_id\": \"pack_10k\",\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"purchase_id": "pur_a1b2c3d4e5f6g7h8",
"checkout_url": "<string>",
"status": "pending",
"object": "checkout_session"
}Authorizations
Short-lived JWT issued by the CarHub auth service (Better Auth), verified against its
JWKS. Claims: sub (user), org_id (active organisation) and role
(owner | admin | member | billing_manager). Used by the dashboard for /mgmt/v1/… only — it is never
accepted on /v1/….
Headers
Client-generated key (a UUID is ideal) making this POST safe to retry. The first request
is executed and its response stored for 24 h; any replay with the same key returns that
stored response with Idempotent-Replayed: true and bills nothing. Reusing a key with a
different payload is a 409 idempotency_key_reuse.
8 - 255Body
Response
Session created; redirect the browser to url.