Change plan
curl --request POST \
--url https://api.useplinth.com/v1/subscriptions/{id}/change \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan_id": "pln_01JABC...",
"quantity": 1
}
'import requests
url = "https://api.useplinth.com/v1/subscriptions/{id}/change"
payload = {
"plan_id": "pln_01JABC...",
"quantity": 1
}
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({plan_id: 'pln_01JABC...', quantity: 1})
};
fetch('https://api.useplinth.com/v1/subscriptions/{id}/change', 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.useplinth.com/v1/subscriptions/{id}/change",
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([
'plan_id' => 'pln_01JABC...',
'quantity' => 1
]),
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.useplinth.com/v1/subscriptions/{id}/change"
payload := strings.NewReader("{\n \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\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.useplinth.com/v1/subscriptions/{id}/change")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useplinth.com/v1/subscriptions/{id}/change")
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 \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"object": "subscription",
"strategy": "immediate_prorated",
"direction": "upgrade",
"invoice_id": "<string>",
"amount_charged_minor": "<string>",
"credit_applied_minor": "<string>",
"scheduled_for": "2023-11-07T05:31:56Z"
}Subscriptions
Change plan
Commits a plan change. For upgrades (by default): charges the prorated difference immediately. For downgrades (by default): schedules the change at the next period end — no charge now. This behaviour is controlled by your TenantPolicy preset.
POST
/
v1
/
subscriptions
/
{id}
/
change
Change plan
curl --request POST \
--url https://api.useplinth.com/v1/subscriptions/{id}/change \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"plan_id": "pln_01JABC...",
"quantity": 1
}
'import requests
url = "https://api.useplinth.com/v1/subscriptions/{id}/change"
payload = {
"plan_id": "pln_01JABC...",
"quantity": 1
}
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({plan_id: 'pln_01JABC...', quantity: 1})
};
fetch('https://api.useplinth.com/v1/subscriptions/{id}/change', 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.useplinth.com/v1/subscriptions/{id}/change",
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([
'plan_id' => 'pln_01JABC...',
'quantity' => 1
]),
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.useplinth.com/v1/subscriptions/{id}/change"
payload := strings.NewReader("{\n \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\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.useplinth.com/v1/subscriptions/{id}/change")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useplinth.com/v1/subscriptions/{id}/change")
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 \"plan_id\": \"pln_01JABC...\",\n \"quantity\": 1\n}"
response = http.request(request)
puts response.read_body{
"object": "subscription",
"strategy": "immediate_prorated",
"direction": "upgrade",
"invoice_id": "<string>",
"amount_charged_minor": "<string>",
"credit_applied_minor": "<string>",
"scheduled_for": "2023-11-07T05:31:56Z"
}Authorizations
Use sk_test_ keys for sandbox. Use sk_live_ keys for production. Obtain your key from the dashboard.
Path Parameters
Response
200 - application/json
Plan changed or change scheduled
Available options:
subscription Available options:
immediate_prorated, at_period_end, at_trial_end Available options:
upgrade, downgrade, lateral