Billing
Upgrade Plan
Upgrade to a higher subscription plan
POST
/
v1
/
billing
/
upgrade
Upgrade Plan
curl --request POST \
--url https://api.example.com/v1/billing/upgradeimport requests
url = "https://api.example.com/v1/billing/upgrade"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/upgrade', 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/upgrade",
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/upgrade"
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/upgrade")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/upgrade")
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_bodyFor existing subscribers, returns a billing portal URL for plan change (with automatic proration). For users without an active subscription, creates a new subscription checkout.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | starter or pro |
Response (existing subscriber)
{
"portal_url": "https://billing.example.com/p/session/...",
"hint": "Open the portal URL to manage your subscription and change plans."
}
Response (no subscription)
Same asPOST /v1/billing/subscribe.⌘I
Upgrade Plan
curl --request POST \
--url https://api.example.com/v1/billing/upgradeimport requests
url = "https://api.example.com/v1/billing/upgrade"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/billing/upgrade', 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/upgrade",
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/upgrade"
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/upgrade")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/billing/upgrade")
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