curl --request POST \
--url https://test-api.segmnt.cloud/v1/billing/checkout \
--header 'Content-Type: application/json' \
--cookie segmnt_session= \
--data '
{
"planId": "free",
"discountCode": "<string>"
}
'import requests
url = "https://test-api.segmnt.cloud/v1/billing/checkout"
payload = {
"planId": "free",
"discountCode": "<string>"
}
headers = {
"cookie": "segmnt_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'segmnt_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({planId: 'free', discountCode: '<string>'})
};
fetch('https://test-api.segmnt.cloud/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://test-api.segmnt.cloud/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([
'planId' => 'free',
'discountCode' => '<string>'
]),
CURLOPT_COOKIE => "segmnt_session=",
CURLOPT_HTTPHEADER => [
"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://test-api.segmnt.cloud/v1/billing/checkout"
payload := strings.NewReader("{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "segmnt_session=")
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://test-api.segmnt.cloud/v1/billing/checkout")
.header("cookie", "segmnt_session=")
.header("Content-Type", "application/json")
.body("{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/billing/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'segmnt_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"checkoutUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Start a checkout (paused)
Paid billing is paused (board decision, 14 Oct 2026): every payment
gateway is blocked, so no provider is active. This call cannot start a
payment and cannot change a plan; it answers 503 billing_paused before it
reaches any provider. Ask the customer to join the paid-plan whitelist
(POST /v1/billing/whitelist) instead.
When the board turns billing on (BILLING_PROVIDER=moyasar|polar), this
returns the provider’s hosted checkout page, and the plan changes only when
the provider’s payment webhook confirms the payment.
curl --request POST \
--url https://test-api.segmnt.cloud/v1/billing/checkout \
--header 'Content-Type: application/json' \
--cookie segmnt_session= \
--data '
{
"planId": "free",
"discountCode": "<string>"
}
'import requests
url = "https://test-api.segmnt.cloud/v1/billing/checkout"
payload = {
"planId": "free",
"discountCode": "<string>"
}
headers = {
"cookie": "segmnt_session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'segmnt_session=', 'Content-Type': 'application/json'},
body: JSON.stringify({planId: 'free', discountCode: '<string>'})
};
fetch('https://test-api.segmnt.cloud/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://test-api.segmnt.cloud/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([
'planId' => 'free',
'discountCode' => '<string>'
]),
CURLOPT_COOKIE => "segmnt_session=",
CURLOPT_HTTPHEADER => [
"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://test-api.segmnt.cloud/v1/billing/checkout"
payload := strings.NewReader("{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "segmnt_session=")
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://test-api.segmnt.cloud/v1/billing/checkout")
.header("cookie", "segmnt_session=")
.header("Content-Type", "application/json")
.body("{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/billing/checkout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'segmnt_session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"planId\": \"free\",\n \"discountCode\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"checkoutUrl": "<string>",
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Authorizations
Dashboard session cookie, set after SSO sign-in.
Headers
Any unique string. A retry with the same key within 24 hours returns the first result.
255Body
Plan names and prices are set by the board. Examples are not real plans.
"free"
An optional discount code. A founding code gives 30% off and
a referral code 10% off; the total discount is capped at 40%.
Codes are case-insensitive. The code is validated before the
provider is called: an unknown, expired, or out-of-uses code
answers 400 invalid_request with a clear message and never
charges the full price by accident. An empty or blank string
is treated as no code.
A code applied to a subscription is re-applied on each renewal
for the promised number of months (founding and referral
referrer 12, referral new customer 3). Send no discountCode
on a renewal and the promise stored on the subscription is
applied automatically; once the window is used up the renewal
is at the full price.
64