Change plan
curl --request POST \
--url https://commet.co/api/v1/subscriptions/{id}/change-plan \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"newPlanId": "<string>",
"successUrl": "<string>",
"promoCode": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newPlanId: '<string>', successUrl: '<string>', promoCode: '<string>'})
};
fetch('https://commet.co/api/v1/subscriptions/{id}/change-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://commet.co/api/v1/subscriptions/{id}/change-plan"
payload = {
"newPlanId": "<string>",
"successUrl": "<string>",
"promoCode": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://commet.co/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"newPlanId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"promoCode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-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://commet.co/api/v1/subscriptions/{id}/change-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newPlanId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"promoCode\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://commet.co/api/v1/subscriptions/{id}/change-plan",
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([
'newPlanId' => '<string>',
'successUrl' => '<string>',
'promoCode' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"object": "subscription",
"livemode": true,
"requiresCheckout": true,
"checkoutUrl": "<string>",
"id": "<string>",
"scheduled": true,
"scheduledFor": "2023-11-07T05:31:56Z",
"changeType": "subscription.plan_downgrade",
"customerId": "<string>",
"newPlanId": "<string>",
"newPlanName": "<string>",
"newBillingInterval": "<string>",
"previousPlan": {
"id": "<string>",
"name": "<string>"
},
"currentPlan": {
"id": "<string>",
"name": "<string>",
"price": 0
},
"billingInterval": "<string>",
"billing": {
"credit": 0,
"creditsApplied": 0,
"charge": 0,
"taxAmount": 0,
"netAmount": 0,
"totalCharged": 0,
"remainingCreditBalance": 0
},
"invoiceId": "<string>",
"seatLimitWarning": {
"featureCode": "<string>",
"featureName": "<string>",
"currentSeats": 0,
"included": 0,
"newPlanName": "<string>",
"effectiveDate": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}Subscriptions
Change plan
Upgrade, downgrade, or change billing interval. An immediate change can apply the Offer of a promoCode; scheduled changes do not accept it.
POST
/
subscriptions
/
{id}
/
change-plan
Change plan
curl --request POST \
--url https://commet.co/api/v1/subscriptions/{id}/change-plan \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"newPlanId": "<string>",
"successUrl": "<string>",
"promoCode": "<string>"
}
'const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({newPlanId: '<string>', successUrl: '<string>', promoCode: '<string>'})
};
fetch('https://commet.co/api/v1/subscriptions/{id}/change-plan', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://commet.co/api/v1/subscriptions/{id}/change-plan"
payload = {
"newPlanId": "<string>",
"successUrl": "<string>",
"promoCode": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://commet.co/api/v1/subscriptions/{id}/change-plan"
payload := strings.NewReader("{\n \"newPlanId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"promoCode\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-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://commet.co/api/v1/subscriptions/{id}/change-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"newPlanId\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"promoCode\": \"<string>\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://commet.co/api/v1/subscriptions/{id}/change-plan",
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([
'newPlanId' => '<string>',
'successUrl' => '<string>',
'promoCode' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"success": true,
"data": {
"object": "subscription",
"livemode": true,
"requiresCheckout": true,
"checkoutUrl": "<string>",
"id": "<string>",
"scheduled": true,
"scheduledFor": "2023-11-07T05:31:56Z",
"changeType": "subscription.plan_downgrade",
"customerId": "<string>",
"newPlanId": "<string>",
"newPlanName": "<string>",
"newBillingInterval": "<string>",
"previousPlan": {
"id": "<string>",
"name": "<string>"
},
"currentPlan": {
"id": "<string>",
"name": "<string>",
"price": 0
},
"billingInterval": "<string>",
"billing": {
"credit": 0,
"creditsApplied": 0,
"charge": 0,
"taxAmount": 0,
"netAmount": 0,
"totalCharged": 0,
"remainingCreditBalance": 0
},
"invoiceId": "<string>",
"seatLimitWarning": {
"featureCode": "<string>",
"featureName": "<string>",
"currentSeats": 0,
"included": 0,
"newPlanName": "<string>",
"effectiveDate": "2023-11-07T05:31:56Z"
}
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"type": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"param": "<string>",
"details": "<unknown>"
}
}This reference describes API version
2026-06-07. Send Commet-Version: 2026-06-07 with your request.Encabezados
Cuerpo
application/json
¿Esta página le ayudó?