Update
curl --request PATCH \
--url https://{defaultHost}/v1/periods/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"period": {
"end_at": 1793800532
}
}
'import requests
url = "https://{defaultHost}/v1/periods/{id}"
payload = { "period": { "end_at": 1793800532 } }
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({period: {end_at: 1793800532}})
};
fetch('https://{defaultHost}/v1/periods/{id}', 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/periods/{id}",
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([
'period' => [
'end_at' => 1793800532
]
]),
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/periods/{id}"
payload := strings.NewReader("{\n \"period\": {\n \"end_at\": 1793800532\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/periods/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"period\": {\n \"end_at\": 1793800532\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/periods/{id}")
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 \"period\": {\n \"end_at\": 1793800532\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "43cb1e45-dd6b-42bf-be4b-2bd6f6a9b41f",
"object": "period",
"ad_hoc_amount": null,
"end_at": 1793800532,
"next_payment_retry_at": null,
"payment_retry_count": 0,
"payoff": false,
"quantity": 1,
"renewal": false,
"renewal_reminder_sent_at": null,
"restoral": false,
"skip_proration": false,
"start_at": 1793796932,
"status": "paid",
"checkout": "c79def14-ba80-4ae9-9086-899f43266bd4",
"price": "606b8208-b9a6-41ab-b0ab-8d8ba5438da1",
"subscription": "005da6dc-ec85-42fb-9e46-cbff3ac086ce",
"variant": null,
"created_at": 1793796932,
"updated_at": 1793796932
}Periods
Update
Updates a specific period.
PATCH
/
v1
/
periods
/
{id}
Update
curl --request PATCH \
--url https://{defaultHost}/v1/periods/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"period": {
"end_at": 1793800532
}
}
'import requests
url = "https://{defaultHost}/v1/periods/{id}"
payload = { "period": { "end_at": 1793800532 } }
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({period: {end_at: 1793800532}})
};
fetch('https://{defaultHost}/v1/periods/{id}', 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/periods/{id}",
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([
'period' => [
'end_at' => 1793800532
]
]),
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/periods/{id}"
payload := strings.NewReader("{\n \"period\": {\n \"end_at\": 1793800532\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/periods/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"period\": {\n \"end_at\": 1793800532\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/periods/{id}")
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 \"period\": {\n \"end_at\": 1793800532\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "43cb1e45-dd6b-42bf-be4b-2bd6f6a9b41f",
"object": "period",
"ad_hoc_amount": null,
"end_at": 1793800532,
"next_payment_retry_at": null,
"payment_retry_count": 0,
"payoff": false,
"quantity": 1,
"renewal": false,
"renewal_reminder_sent_at": null,
"restoral": false,
"skip_proration": false,
"start_at": 1793796932,
"status": "paid",
"checkout": "c79def14-ba80-4ae9-9086-899f43266bd4",
"price": "606b8208-b9a6-41ab-b0ab-8d8ba5438da1",
"subscription": "005da6dc-ec85-42fb-9e46-cbff3ac086ce",
"variant": null,
"created_at": 1793796932,
"updated_at": 1793796932
}Authorizations
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?