curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/versionMigration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetVersionNumber": 2
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/versionMigration"
payload = { "targetVersionNumber": 2 }
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({targetVersionNumber: 2})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/versionMigration', 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.paygentic.io/v0/subscriptions/{id}/versionMigration",
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([
'targetVersionNumber' => 2
]),
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.paygentic.io/v0/subscriptions/{id}/versionMigration"
payload := strings.NewReader("{\n \"targetVersionNumber\": 2\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.paygentic.io/v0/subscriptions/{id}/versionMigration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetVersionNumber\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/versionMigration")
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 \"targetVersionNumber\": 2\n}"
response = http.request(request)
puts response.read_body{
"subscription": {
"id": "sub_j1k2l3m4n5o6p7q8",
"object": "subscription",
"versionPolicy": "pinned",
"autoCharge": true,
"taxExempt": true,
"createdAt": "2024-02-01T14:45:30Z",
"customerId": "cus_r9s0t1u2v3w4x5y6",
"endingAt": "2024-12-31T23:59:59Z",
"estimatedTaxRate": 0,
"name": "Analytics Co - Data Platform Enterprise",
"payment": null,
"planId": "plan_z7a8b9c0d1e2f3g4",
"startedAt": "2024-02-01T14:45:30Z",
"status": "active",
"terminatedAt": null,
"terminatedBy": null,
"terminationReason": null,
"updatedAt": "2024-02-15T09:20:00Z",
"planVersionId": "pver_u2v3w4x5y6z7a8b9",
"versionNumber": 2
},
"migration": {
"fromVersionNumber": 1,
"toVersionNumber": 2,
"effectiveAt": "2024-03-01T00:00:00Z",
"changed": true
},
"lineItems": {
"syncFailed": false
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Migrate To A Plan Version
Moves the subscription to a named version of its plan. The move takes effect at the end of the current billing period: the current period bills as before, and each period that starts at or after that boundary bills from the target version. The target can be an older or a newer published version. A migration always sets versionPolicy to pinned, so a later change of the plan’s default version does not move the subscription. To follow the plan default again, call PATCH /v0/subscriptions/ with versionPolicy: ‘floating’. A second migration before the boundary replaces the first. Migrating to the version the subscription is already on changes nothing except that it pins a floating subscription, so it is safe to repeat. A version number that does not exist on the plan and an archived version both return 404. The request is refused with 409 and a code when: the subscription is not live; the subscription ends at or before the boundary; a kept override has a rate that would mean something else on the new price; a feature’s reset period, metric or pricing unit changes; or the new version sells a price that a continuing interval already covers.
curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/versionMigration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"targetVersionNumber": 2
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/versionMigration"
payload = { "targetVersionNumber": 2 }
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({targetVersionNumber: 2})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/versionMigration', 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.paygentic.io/v0/subscriptions/{id}/versionMigration",
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([
'targetVersionNumber' => 2
]),
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.paygentic.io/v0/subscriptions/{id}/versionMigration"
payload := strings.NewReader("{\n \"targetVersionNumber\": 2\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.paygentic.io/v0/subscriptions/{id}/versionMigration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"targetVersionNumber\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/versionMigration")
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 \"targetVersionNumber\": 2\n}"
response = http.request(request)
puts response.read_body{
"subscription": {
"id": "sub_j1k2l3m4n5o6p7q8",
"object": "subscription",
"versionPolicy": "pinned",
"autoCharge": true,
"taxExempt": true,
"createdAt": "2024-02-01T14:45:30Z",
"customerId": "cus_r9s0t1u2v3w4x5y6",
"endingAt": "2024-12-31T23:59:59Z",
"estimatedTaxRate": 0,
"name": "Analytics Co - Data Platform Enterprise",
"payment": null,
"planId": "plan_z7a8b9c0d1e2f3g4",
"startedAt": "2024-02-01T14:45:30Z",
"status": "active",
"terminatedAt": null,
"terminatedBy": null,
"terminationReason": null,
"updatedAt": "2024-02-15T09:20:00Z",
"planVersionId": "pver_u2v3w4x5y6z7a8b9",
"versionNumber": 2
},
"migration": {
"fromVersionNumber": 1,
"toVersionNumber": 2,
"effectiveAt": "2024-03-01T00:00:00Z",
"changed": true
},
"lineItems": {
"syncFailed": false
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Authorizations
API key authentication
Path Parameters
The subscription ID
Body
The plan version to move the subscription to.
The number of a published version of the subscription's plan.
1 <= x <= 2147483647Was this page helpful?