Billing
Buy Credits
Purchase a credit pack via checkout
POST
/
v1
/
billing
/
topup
Buy Credits
curl --request POST \
--url https://api.example.com/v1/billing/topupimport requests
url = "https://api.example.com/v1/billing/topup"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/topup', 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.example.com/v1/billing/topup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/billing/topup"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/billing/topup")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/topup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyCreates a checkout session for a one-time credit pack purchase. Credits are added to the account immediately after payment.
Use
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
pack_id | string | Yes | Pack ID: small, medium, large, or xl |
Response
{
"checkout_url": "https://checkout.example.com/c/pay/...",
"session_id": "cs_live_...",
"pack": { "id": "medium", "credits": 500, "price": "$23" },
"expires_at": "2026-05-02T11:30:00Z",
"hint": "Open the checkout URL to complete payment. Credits are added immediately after payment."
}
GET /v1/billing/packs to see all available packs and their pricing.⌘I
Buy Credits
curl --request POST \
--url https://api.example.com/v1/billing/topupimport requests
url = "https://api.example.com/v1/billing/topup"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/topup', 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.example.com/v1/billing/topup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/billing/topup"
req, _ := http.NewRequest("POST", url, nil)
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.example.com/v1/billing/topup")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/topup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body