Update
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"quantity": 2
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}"
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}', 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}",
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}"
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}")
.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}")
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": "af6f980e-71e7-40fc-adcc-23354173f372",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": false,
"currency": "usd",
"current_period_end_at": 1798655998,
"current_period_start_at": 1796063998,
"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/af6f980e-71e7-40fc-adcc-23354173f372",
"quantity": 2,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": null,
"subtotal_amount": 5800,
"status": "past_due",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": null,
"current_period": "60c23907-71eb-46e7-88fc-1afda305b55b",
"customer": "e7a7ce85-3a2c-4bde-8aad-69a2d7726e8a",
"discount": null,
"manual_payment_method": null,
"payment_method": "c5a21b19-d945-444d-8c2a-9795be26ec36",
"price": "9a0f4942-24dd-4eb4-8bfb-1f85d710f8d7",
"purchase": "bb7bc7d4-bf68-4bae-8b69-544c2468c8f3",
"shipping_method": null,
"variant": null,
"created_at": 1796063997,
"updated_at": 1796063998
}Subscriptions
Update
Updates a specific subscription.
PATCH
/
v1
/
subscriptions
/
{id}
Update
curl --request PATCH \
--url https://{defaultHost}/v1/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscription": {
"quantity": 2
}
}
'import requests
url = "https://{defaultHost}/v1/subscriptions/{id}"
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}', 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}",
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}"
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}")
.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}")
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": "af6f980e-71e7-40fc-adcc-23354173f372",
"object": "subscription",
"ad_hoc_amount": null,
"affiliation_expires_at": null,
"cancel_at_period_end": false,
"currency": "usd",
"current_period_end_at": 1798655998,
"current_period_start_at": 1796063998,
"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/af6f980e-71e7-40fc-adcc-23354173f372",
"quantity": 2,
"remaining_period_count": null,
"restart_on_completed": false,
"restore_at": null,
"subtotal_amount": 5800,
"status": "past_due",
"tax_enabled": false,
"trial_end_at": null,
"trial_start_at": null,
"variant_options": null,
"affiliation": null,
"current_cancellation_act": null,
"current_period": "60c23907-71eb-46e7-88fc-1afda305b55b",
"customer": "e7a7ce85-3a2c-4bde-8aad-69a2d7726e8a",
"discount": null,
"manual_payment_method": null,
"payment_method": "c5a21b19-d945-444d-8c2a-9795be26ec36",
"price": "9a0f4942-24dd-4eb4-8bfb-1f85d710f8d7",
"purchase": "bb7bc7d4-bf68-4bae-8b69-544c2468c8f3",
"shipping_method": null,
"variant": null,
"created_at": 1796063997,
"updated_at": 1796063998
}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?