curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/intervals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edit": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"unitPrice": "9.00"
}
]
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/intervals"
payload = { "edit": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"unitPrice": "9.00"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({edit: [{id: 'spi_p9q0r1s2t3u4v5w6', unitPrice: '9.00'}]})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/intervals', 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.paygentic.io/v0/subscriptions/{id}/intervals",
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([
'edit' => [
[
'id' => 'spi_p9q0r1s2t3u4v5w6',
'unitPrice' => '9.00'
]
]
]),
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://api.paygentic.io/v0/subscriptions/{id}/intervals"
payload := strings.NewReader("{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.paygentic.io/v0/subscriptions/{id}/intervals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/intervals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"intervals": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"priceId": "price_x7y8z9a0b1c2d3e4",
"priceKey": "pk_m4n5o6p7q8r9s0t1",
"kind": "plan_line",
"planVersionId": "pv_u2v3w4x5y6z7a8b9",
"unitPrice": "9.00",
"baseQuantity": "1",
"quantityTransitions": [],
"billingCadence": "P1M",
"billingMode": "advance",
"billDate": null,
"startDate": "2024-02-01T14:45:30Z",
"endDate": null
}
],
"unchanged": false,
"lineItems": {
"created": 1,
"removed": 0
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Edit Price Intervals
Adds, edits, or removes price intervals on the subscription. Use an add to override a plan price for a period. Use an edit to change unitPrice, baseQuantity, quantityTransitions, or endDate. Use a remove to delete an interval. To close a price, set endDate. To re-open it, set endDate to null. To send an interval from a GET response as an edit, remove kind from it. An edit with no changed field changes nothing. If you send an add again after a timeout, it fails with 409 because it overlaps the first add. Use GET to check the result. The request is rejected if it changes a billing period that already exists, leaves a gap or an overlap, or bills a one-off price more than once.
curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/intervals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"edit": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"unitPrice": "9.00"
}
]
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/intervals"
payload = { "edit": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"unitPrice": "9.00"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({edit: [{id: 'spi_p9q0r1s2t3u4v5w6', unitPrice: '9.00'}]})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/intervals', 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.paygentic.io/v0/subscriptions/{id}/intervals",
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([
'edit' => [
[
'id' => 'spi_p9q0r1s2t3u4v5w6',
'unitPrice' => '9.00'
]
]
]),
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://api.paygentic.io/v0/subscriptions/{id}/intervals"
payload := strings.NewReader("{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.paygentic.io/v0/subscriptions/{id}/intervals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/intervals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edit\": [\n {\n \"id\": \"spi_p9q0r1s2t3u4v5w6\",\n \"unitPrice\": \"9.00\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"intervals": [
{
"id": "spi_p9q0r1s2t3u4v5w6",
"priceId": "price_x7y8z9a0b1c2d3e4",
"priceKey": "pk_m4n5o6p7q8r9s0t1",
"kind": "plan_line",
"planVersionId": "pv_u2v3w4x5y6z7a8b9",
"unitPrice": "9.00",
"baseQuantity": "1",
"quantityTransitions": [],
"billingCadence": "P1M",
"billingMode": "advance",
"billDate": null,
"startDate": "2024-02-01T14:45:30Z",
"endDate": null
}
],
"unchanged": false,
"lineItems": {
"created": 1,
"removed": 0
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Body
- Option 1
- Option 2
- Option 3
The operations to apply. At least one of add, edit or remove is required.
Why a change was made. correction repairs data that was entered wrong; migration moves a contract from another system; commercial is a real change to the deal; contractual applies a step the original contract scheduled, such as an annual uplift. Defaults to unspecified.
commercial, correction, migration, unspecified, contractual Response
The price intervals after the changes. If the request changed nothing, unchanged is true.
Was this page helpful?