Create billing checkout session
curl --request POST \
--url https://api.videodb.io/billing/checkout \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'payment', plan_id: 'plan-basic', amount: 100})
};
fetch('https://api.videodb.io/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.videodb.io/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([
'mode' => 'payment',
'plan_id' => 'plan-basic',
'amount' => 100
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <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://api.videodb.io/billing/checkout"
payload := strings.NewReader("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<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://api.videodb.io/billing/checkout")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/billing/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/billing/checkout' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
}'import Foundation
let parameters = [
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/billing/checkout")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/billing/checkout");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/billing/checkout");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'payment', plan_id: 'plan-basic', amount: 100})
};
fetch('https://api.videodb.io/billing/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/billing/checkout");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/billing/checkout");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
val request = Request.Builder()
.url("https://api.videodb.io/billing/checkout")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"url": "https://checkout.stripe.com/pay/xxx"
}
}Create Checkout Session
Create a payment checkout session to purchase credits
POST
/
billing
/
checkout
Create billing checkout session
curl --request POST \
--url https://api.videodb.io/billing/checkout \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'payment', plan_id: 'plan-basic', amount: 100})
};
fetch('https://api.videodb.io/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.videodb.io/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([
'mode' => 'payment',
'plan_id' => 'plan-basic',
'amount' => 100
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <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://api.videodb.io/billing/checkout"
payload := strings.NewReader("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<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://api.videodb.io/billing/checkout")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/billing/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/billing/checkout' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
}'import Foundation
let parameters = [
"mode": "payment",
"plan_id": "plan-basic",
"amount": 100
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/billing/checkout")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/billing/checkout");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/billing/checkout");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({mode: 'payment', plan_id: 'plan-basic', amount: 100})
};
fetch('https://api.videodb.io/billing/checkout', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/billing/checkout");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/billing/checkout");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"mode\": \"payment\",\n \"plan_id\": \"plan-basic\",\n \"amount\": 100\n}")
val request = Request.Builder()
.url("https://api.videodb.io/billing/checkout")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"url": "https://checkout.stripe.com/pay/xxx"
}
}Initiate a checkout session to purchase credits using your preferred payment method. Returns a checkout URL for the payment flow.
import requests
payload = {
"amount": 50,
"success_url": "https://yourapp.com/billing/success",
"cancel_url": "https://yourapp.com/billing/cancelled"
}
response = requests.post(
"https://api.videodb.io/billing/checkout",
json=payload,
headers={"x-access-token": "your_api_key"}
)
checkout_data = response.json()
print(f"Checkout URL: {checkout_data.get('checkout_url')}")
print(f"Session ID: {checkout_data.get('id')}")
const payload = {
amount: 50,
successUrl: "https://yourapp.com/billing/success",
cancelUrl: "https://yourapp.com/billing/cancelled"
};
const response = await fetch("https://api.videodb.io/billing/checkout", {
method: "POST",
headers: {
"x-access-token": "your_api_key",
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
const checkoutData = await response.json();
console.log(`Checkout URL: ${checkoutData.checkoutUrl}`);
console.log(`Session ID: ${checkoutData.id}`);
- Amount is specified in USD (whole dollars)
- Success and cancel URLs redirect users after payment completion or cancellation
- Checkout sessions expire after 24 hours if not completed
- Credits are added to your account immediately upon successful payment
List Checkouts
View all checkout sessions and their status
Get Usage Statistics
Monitor credit usage and balance
Authorizations
API key for authentication (sk-xxx format)
Body
application/json
⌘I