Price a plan or quantity change
curl --request POST \
--url https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"productId": "pro_9m2k1x8s7d6f",
"quantity": 3,
"effective": "auto",
"proration": "delta"
}
'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview"
payload = {
"productId": "pro_9m2k1x8s7d6f",
"quantity": 3,
"effective": "auto",
"proration": "delta"
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: 'pro_9m2k1x8s7d6f',
quantity: 3,
effective: 'auto',
proration: 'delta'
})
};
fetch('https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview', 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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview",
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([
'productId' => 'pro_9m2k1x8s7d6f',
'quantity' => 3,
'effective' => 'auto',
'proration' => 'delta'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-Key: <api-key>"
],
]);
$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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview"
payload := strings.NewReader("{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"direction": "UPGRADE",
"timing": "immediate",
"effectiveAt": "2023-11-07T05:31:56Z",
"productId": "<string>",
"quantity": 123,
"amountDueNowCents": "<string>",
"amountDueNowVatCents": "<string>",
"recurringAmountCents": "<string>",
"recurringVatCents": "<string>",
"currency": "EUR"
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Subscriptions
Price a plan or quantity change
Same body as change-plan, nothing charged · what to show before the customer confirms (“+1 seat: 5.00 today, then 30.00/month”).
POST
/
v3
/
subscriptions
/
{id}
/
change-plan
/
preview
Price a plan or quantity change
curl --request POST \
--url https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"productId": "pro_9m2k1x8s7d6f",
"quantity": 3,
"effective": "auto",
"proration": "delta"
}
'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview"
payload = {
"productId": "pro_9m2k1x8s7d6f",
"quantity": 3,
"effective": "auto",
"proration": "delta"
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: 'pro_9m2k1x8s7d6f',
quantity: 3,
effective: 'auto',
proration: 'delta'
})
};
fetch('https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview', 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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview",
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([
'productId' => 'pro_9m2k1x8s7d6f',
'quantity' => 3,
'effective' => 'auto',
'proration' => 'delta'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-Key: <api-key>"
],
]);
$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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview"
payload := strings.NewReader("{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}/change-plan/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"pro_9m2k1x8s7d6f\",\n \"quantity\": 3,\n \"effective\": \"auto\",\n \"proration\": \"delta\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"direction": "UPGRADE",
"timing": "immediate",
"effectiveAt": "2023-11-07T05:31:56Z",
"productId": "<string>",
"quantity": 123,
"amountDueNowCents": "<string>",
"amountDueNowVatCents": "<string>",
"recurringAmountCents": "<string>",
"recurringVatCents": "<string>",
"currency": "EUR"
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Authorizations
Secret API key. sk_live_… (production) or sk_sandbox_… (sandbox).
Path Parameters
Example:
"sub_abc123"
Body
application/json
productId, quantity, or both.
Target plan. Omitted = current plan.
Example:
"pro_9m2k1x8s7d6f"
Units to hold afterwards (absolute, not a delta).
Required range:
1 <= x <= 999Example:
3
auto: increase now, decrease at period end.
Available options:
auto, now, period_end delta charges the prorated difference; none charges nothing.
Available options:
delta, none Was this page helpful?

