Create Checkout Session
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"priceId": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout"
payload = {
"priceId": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
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({priceId: '<string>', successUrl: '<string>', cancelUrl: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/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.bunship.com/api/v1/organizations/{orgId}/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([
'priceId' => '<string>',
'successUrl' => '<string>',
'cancelUrl' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout"
payload := strings.NewReader("{\n \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\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.bunship.com/api/v1/organizations/{orgId}/billing/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/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 \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"sessionId": "cs_live_abc123...",
"url": "https://checkout.stripe.com/c/pay/cs_live_abc123..."
}
}
Billing
Create Checkout Session
Create a Stripe Checkout session to subscribe to a plan
POST
/
api
/
v1
/
organizations
/
{orgId}
/
billing
/
checkout
Create Checkout Session
curl --request POST \
--url https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"priceId": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout"
payload = {
"priceId": "<string>",
"successUrl": "<string>",
"cancelUrl": "<string>"
}
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({priceId: '<string>', successUrl: '<string>', cancelUrl: '<string>'})
};
fetch('https://api.bunship.com/api/v1/organizations/{orgId}/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.bunship.com/api/v1/organizations/{orgId}/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([
'priceId' => '<string>',
'successUrl' => '<string>',
'cancelUrl' => '<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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bunship.com/api/v1/organizations/{orgId}/billing/checkout"
payload := strings.NewReader("{\n \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\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.bunship.com/api/v1/organizations/{orgId}/billing/checkout")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bunship.com/api/v1/organizations/{orgId}/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 \"priceId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"sessionId": "cs_live_abc123...",
"url": "https://checkout.stripe.com/c/pay/cs_live_abc123..."
}
}
Creates a Stripe Checkout session for the organization to subscribe to a pricing plan. Returns a session URL to redirect the user to Stripe’s hosted checkout page.
Auth
Requires a valid Bearer token. User must be a member of the organization.
Path Parameters
Organization identifier.
Request Body
Stripe Price ID for the plan to subscribe to (e.g.,
"price_1abc123").URL to redirect to after successful checkout. Must match the configured application origin.
URL to redirect to if the user cancels checkout. Must match the configured application origin.
Response
Always
true on success.{
"success": true,
"data": {
"sessionId": "cs_live_abc123...",
"url": "https://checkout.stripe.com/c/pay/cs_live_abc123..."
}
}
Example
curl -X POST https://api.bunship.com/api/v1/organizations/org_cld2abc123def456/billing/checkout \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
-H "Content-Type: application/json" \
-d '{
"priceId": "price_1abc123",
"successUrl": "https://app.bunship.com/billing?success=true",
"cancelUrl": "https://app.bunship.com/billing"
}'
⌘I

