Upcoming Period
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id}/upcoming_period \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"quantity": 2
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}/upcoming_period"
payload = { "subscription": { "quantity": 2 } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({subscription: {quantity: 2}})
};
fetch('https://{defaultHost}/v1/subscriptions/{id}/upcoming_period', 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://{defaultHost}/v1/subscriptions/{id}/upcoming_period",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'subscription' => [
'quantity' => 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://{defaultHost}/v1/subscriptions/{id}/upcoming_period"
payload := strings.NewReader("{\n \"subscription\": {\n \"quantity\": 2\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{defaultHost}/v1/subscriptions/{id}/upcoming_period")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription\": {\n \"quantity\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/{id}/upcoming_period")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscription\": {\n \"quantity\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "4ec25205-b5c7-41ce-964e-234dc3a113b9",
"object": "period",
"ad_hoc_amount": null,
"end_at": 1798656001,
"next_payment_retry_at": null,
"payment_retry_count": 0,
"payoff": false,
"proration_method": "unused_amount_paid",
"quantity": 2,
"renewal": false,
"renewal_reminder_sent_at": null,
"restoral": false,
"start_at": 1796064001,
"status": "draft",
"checkout": "80816c51-d7de-44e6-8f52-22ff444549e2",
"price": "3df6e957-91fe-4800-813b-0d1895c38228",
"subscription": "5acbd9a3-4e30-40f3-a8d9-c6067bba1d48",
"variant": null,
"created_at": 1796064001,
"updated_at": 1796064001
}Subscriptions
Upcoming Period
Generates a preview of the upcoming period.
PATCH
/
v1
/
subscriptions
/
{id}
/
upcoming_period
Upcoming Period
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id}/upcoming_period \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"quantity": 2
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}/upcoming_period"
payload = { "subscription": { "quantity": 2 } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({subscription: {quantity: 2}})
};
fetch('https://{defaultHost}/v1/subscriptions/{id}/upcoming_period', 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://{defaultHost}/v1/subscriptions/{id}/upcoming_period",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'subscription' => [
'quantity' => 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://{defaultHost}/v1/subscriptions/{id}/upcoming_period"
payload := strings.NewReader("{\n \"subscription\": {\n \"quantity\": 2\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://{defaultHost}/v1/subscriptions/{id}/upcoming_period")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription\": {\n \"quantity\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/{id}/upcoming_period")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscription\": {\n \"quantity\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "4ec25205-b5c7-41ce-964e-234dc3a113b9",
"object": "period",
"ad_hoc_amount": null,
"end_at": 1798656001,
"next_payment_retry_at": null,
"payment_retry_count": 0,
"payoff": false,
"proration_method": "unused_amount_paid",
"quantity": 2,
"renewal": false,
"renewal_reminder_sent_at": null,
"restoral": false,
"start_at": 1796064001,
"status": "draft",
"checkout": "80816c51-d7de-44e6-8f52-22ff444549e2",
"price": "3df6e957-91fe-4800-813b-0d1895c38228",
"subscription": "5acbd9a3-4e30-40f3-a8d9-c6067bba1d48",
"variant": null,
"created_at": 1796064001,
"updated_at": 1796064001
}Authorizations
Query Parameters
Response
200 - application/json
Success
Expandable – The associated checkout ID.
Expandable – The associated price ID.
Expandable – The associated subscription ID.
Expandable – The associated variant ID.
Was this page helpful?