Change a subscription's plan.
curl --request POST \
--url https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"plan_id": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"effective": "next_renewal",
"proration": true
}
'import requests
url = "https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan"
payload = {
"plan_id": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"effective": "next_renewal",
"proration": True
}
headers = {
"x-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-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
plan_id: '1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809',
effective: 'next_renewal',
proration: true
})
};
fetch('https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan', 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://dash.dmly.io/api/v1/subscriptions/{subscription}/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([
'plan_id' => '1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809',
'effective' => 'next_renewal',
'proration' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan"
payload := strings.NewReader("{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\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://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Change a subscription's plan.
Moves the subscription to a different plan (identified by its uuid). effective controls when the change lands: ‘now’ switches immediately, ‘next_renewal’ (the default) defers it to the next billing date. proration defaults to true and, when switching now, applies a credit or charge for the unused portion of the current period. Returns the updated subscription, or 422 if the change is not allowed.
POST
/
subscriptions
/
{subscription}
/
change-plan
Change a subscription's plan.
curl --request POST \
--url https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"plan_id": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"effective": "next_renewal",
"proration": true
}
'import requests
url = "https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan"
payload = {
"plan_id": "1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809",
"effective": "next_renewal",
"proration": True
}
headers = {
"x-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-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
plan_id: '1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809',
effective: 'next_renewal',
proration: true
})
};
fetch('https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan', 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://dash.dmly.io/api/v1/subscriptions/{subscription}/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([
'plan_id' => '1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809',
'effective' => 'next_renewal',
'proration' => true
]),
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;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan"
payload := strings.NewReader("{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\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://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dash.dmly.io/api/v1/subscriptions/{subscription}/change-plan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"plan_id\": \"1a2b3c4d-5e6f-7081-92a3-b4c5d6e7f809\",\n \"effective\": \"next_renewal\",\n \"proration\": true\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Was this page helpful?
⌘I

