Cancel/Pause
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"restore_at": "2027-01-04 12:56:49 UTC"
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}/cancel"
payload = { "subscription": { "restore_at": "2027-01-04 12:56:49 UTC" } }
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: {restore_at: '2027-01-04 12:56:49 UTC'}})
};
fetch('https://{defaultHost}/v1/subscriptions/{id}/cancel', 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}/cancel",
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' => [
'restore_at' => '2027-01-04 12:56:49 UTC'
]
]),
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}/cancel"
payload := strings.NewReader("{\n \"subscription\": {\n \"restore_at\": \"2027-01-04 12:56:49 UTC\"\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}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription\": {\n \"restore_at\": \"2027-01-04 12:56:49 UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/{id}/cancel")
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 \"restore_at\": \"2027-01-04 12:56:49 UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "48ae659b-ed0d-4953-a5b6-0e2c42004095",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": true,
"currency": "usd",
"current_period_end_at": 1796389009,
"current_period_start_at": 1793797009,
"ended_at": null,
"finite": false,
"last_renewal_reminder_sent_at": null,
"live_mode": true,
"manual_payment": false,
"metadata": {},
"pending_update": {},
"price_readonly": false,
"portal_url": "http://app.example.com/portal_redirect/subscriptions/48ae659b-ed0d-4953-a5b6-0e2c42004095",
"quantity": 1,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": 1799067409,
"subtotal_amount": 2900,
"status": "active",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": "eb842b00-183d-41e1-98f1-09bf21d66895",
"current_period": "7fb50620-e988-4083-9210-510edf84fc75",
"customer": "d546318b-fd83-4b20-975e-ee46c788a973",
"discount": null,
"manual_payment_method": null,
"payment_method": "429e7cc2-9de7-445b-a94f-6cf78460e284",
"price": "c0c2b935-0425-4e13-a8cb-0b3063a6020d",
"purchase": "bc600e89-196f-41ce-a7c6-bf40ed0f15d1",
"shipping_method": null,
"variant": null,
"created_at": 1793797009,
"updated_at": 1793797009
}Subscriptions
Cancel/Pause
Cancels a specific subscription. If a restore_at value is provided, the subscription will be effectively “paused” until that date when it will automatically renew.
PATCH
/
v1
/
subscriptions
/
{id}
/
cancel
Cancel/Pause
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"restore_at": "2027-01-04 12:56:49 UTC"
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}/cancel"
payload = { "subscription": { "restore_at": "2027-01-04 12:56:49 UTC" } }
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: {restore_at: '2027-01-04 12:56:49 UTC'}})
};
fetch('https://{defaultHost}/v1/subscriptions/{id}/cancel', 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}/cancel",
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' => [
'restore_at' => '2027-01-04 12:56:49 UTC'
]
]),
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}/cancel"
payload := strings.NewReader("{\n \"subscription\": {\n \"restore_at\": \"2027-01-04 12:56:49 UTC\"\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}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscription\": {\n \"restore_at\": \"2027-01-04 12:56:49 UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/subscriptions/{id}/cancel")
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 \"restore_at\": \"2027-01-04 12:56:49 UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "48ae659b-ed0d-4953-a5b6-0e2c42004095",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": true,
"currency": "usd",
"current_period_end_at": 1796389009,
"current_period_start_at": 1793797009,
"ended_at": null,
"finite": false,
"last_renewal_reminder_sent_at": null,
"live_mode": true,
"manual_payment": false,
"metadata": {},
"pending_update": {},
"price_readonly": false,
"portal_url": "http://app.example.com/portal_redirect/subscriptions/48ae659b-ed0d-4953-a5b6-0e2c42004095",
"quantity": 1,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": 1799067409,
"subtotal_amount": 2900,
"status": "active",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": "eb842b00-183d-41e1-98f1-09bf21d66895",
"current_period": "7fb50620-e988-4083-9210-510edf84fc75",
"customer": "d546318b-fd83-4b20-975e-ee46c788a973",
"discount": null,
"manual_payment_method": null,
"payment_method": "429e7cc2-9de7-445b-a94f-6cf78460e284",
"price": "c0c2b935-0425-4e13-a8cb-0b3063a6020d",
"purchase": "bc600e89-196f-41ce-a7c6-bf40ed0f15d1",
"shipping_method": null,
"variant": null,
"created_at": 1793797009,
"updated_at": 1793797009
}Authorizations
Query Parameters
Response
200 - application/json
Success
Expandable – The associated cancellation act ID.
Expandable – The associated period ID.
Expandable – The associated customer ID.
Expandable – The associated discount ID.
Expandable – The associated manual payment method ID.
Expandable – The associated payment method ID.
Expandable – Property not returned unless expanded.
Expandable – The associated price ID.
Expandable – The associated purchase ID.
Expandable – The associated shipping method ID.
Expandable – The associated variant ID.
Was this page helpful?