curl --request POST \
--url https://api.cope.com/v1/commerce/subscriptions/{id}/price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount_cents": 50000050,
"currency": "<string>",
"has_net_price": true,
"reason": "<string>"
}
'import requests
url = "https://api.cope.com/v1/commerce/subscriptions/{id}/price"
payload = {
"amount_cents": 50000050,
"currency": "<string>",
"has_net_price": True,
"reason": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount_cents: 50000050,
currency: '<string>',
has_net_price: true,
reason: '<string>'
})
};
fetch('https://api.cope.com/v1/commerce/subscriptions/{id}/price', 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.cope.com/v1/commerce/subscriptions/{id}/price",
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([
'amount_cents' => 50000050,
'currency' => '<string>',
'has_net_price' => true,
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.cope.com/v1/commerce/subscriptions/{id}/price"
payload := strings.NewReader("{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.cope.com/v1/commerce/subscriptions/{id}/price")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/subscriptions/{id}/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyChange a subscription's recurring amount
Sets a new recurring amount on a subscription and returns the subscription, with the new
amount in pending_change.
Nothing is charged, credited or prorated now. The change applies from the
subscription’s next renewal; the period the buyer has already paid for is untouched. Until a
renewal bills the new terms, the subscription keeps its current terms and carries the new ones
in pending_change.
A change is refused with 422 too_close_to_renewal when the next renewal is
60 minutes away or less, or already due, because that renewal may
already be billing: send it again once the renewal has billed. When no renewal date is known the change
is refused with 422 subscription_not_eligible, errors[0].code renewal_date_unknown.
A new price or plan change replaces one still in pending_change: only the latest reaches the next
renewal. PayPal subscriptions cannot be repriced or moved to another plan through the API: the change is
refused with 422 subscription_not_eligible, errors[0].code non_stripe_rail, and so is a change to a
subscription with a quantity above 1, with quantity_unsupported.
Requires the subscriptions permission at write. An API key holds a permission at the lower of its own level (read for a read-only key) and its holder’s role; a key without it is refused with 403.
curl --request POST \
--url https://api.cope.com/v1/commerce/subscriptions/{id}/price \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"amount_cents": 50000050,
"currency": "<string>",
"has_net_price": true,
"reason": "<string>"
}
'import requests
url = "https://api.cope.com/v1/commerce/subscriptions/{id}/price"
payload = {
"amount_cents": 50000050,
"currency": "<string>",
"has_net_price": True,
"reason": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount_cents: 50000050,
currency: '<string>',
has_net_price: true,
reason: '<string>'
})
};
fetch('https://api.cope.com/v1/commerce/subscriptions/{id}/price', 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.cope.com/v1/commerce/subscriptions/{id}/price",
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([
'amount_cents' => 50000050,
'currency' => '<string>',
'has_net_price' => true,
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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.cope.com/v1/commerce/subscriptions/{id}/price"
payload := strings.NewReader("{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.cope.com/v1/commerce/subscriptions/{id}/price")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cope.com/v1/commerce/subscriptions/{id}/price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount_cents\": 50000050,\n \"currency\": \"<string>\",\n \"has_net_price\": true,\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Headers
Required. At most 255 characters of valid UTF-8 with no NUL byte. The change attempt is recorded against this key for this subscription, and a retry that carries the same key and the same body does not change the subscription twice: it returns the subscription as it stands now. The exception is an attempt that failed at the payment provider or stopped responding: it is re-checked and then re-attempted. COPE also re-attempts, on its own, an attempt the payment provider did not confirm or that stopped responding, under the same re-check: usually within minutes, for up to 24 hours after it was recorded. The re-check asks whether subscription changes through the API are still enabled for the business and whether another change is still processing (change_in_flight: repeat under the same key once it settles); a price or plan change is also refused as not_active (final) once the subscription has ended and as superseded (final) when another price or plan change has been applied since it was recorded, and a pause, resume or cancel when the subscription has left the status it needs. A refusal of the first request under a key, change_in_flight included, is recorded against that key: once it settles, send the request again under a new key. The same key with a different body is refused with 409 idempotency_conflict.
255Path Parameters
Body
The new recurring amount per unit in minor units, net or gross of tax as has_net_price says. What it bills, the tax included, must be at least 200 (2.00), and at most 99999900 (999,999.00) once multiplied by the quantity. Outside those bounds the change is refused with 422 subscription_not_eligible, errors[0].code invalid_recurring_amount. It bills from the next cycle, with no proration.
200 <= x <= 99999900Optional. Whether amount_cents is net of tax (true: the tax is added on top) or includes it (false: the tax is taken out of it). Omit it to use the basis the subscription's terms are set in, its has_net_price. The tax is worked out at the rate the subscription was sold at. A value other than true or false is refused with 422 validation_failed.
Was this page helpful?