curl --request PATCH \
--url https://api.paygentic.io/v0/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endingAt": "2023-11-07T05:31:56Z",
"status": "terminated",
"terminatedAt": "2023-11-07T05:31:56Z",
"terminatedBy": "<string>",
"terminationReason": "<string>",
"autoCharge": true,
"taxExempt": true,
"minimumAccountBalance": "<string>",
"renewalReminderEnabled": true,
"renewalReminderDays": 15,
"paymentTermDays": 182
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}"
payload = {
"endingAt": "2023-11-07T05:31:56Z",
"status": "terminated",
"terminatedAt": "2023-11-07T05:31:56Z",
"terminatedBy": "<string>",
"terminationReason": "<string>",
"autoCharge": True,
"taxExempt": True,
"minimumAccountBalance": "<string>",
"renewalReminderEnabled": True,
"renewalReminderDays": 15,
"paymentTermDays": 182
}
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({
endingAt: '2023-11-07T05:31:56Z',
status: 'terminated',
terminatedAt: '2023-11-07T05:31:56Z',
terminatedBy: '<string>',
terminationReason: '<string>',
autoCharge: true,
taxExempt: true,
minimumAccountBalance: '<string>',
renewalReminderEnabled: true,
renewalReminderDays: 15,
paymentTermDays: 182
})
};
fetch('https://api.paygentic.io/v0/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://api.paygentic.io/v0/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([
'endingAt' => '2023-11-07T05:31:56Z',
'status' => 'terminated',
'terminatedAt' => '2023-11-07T05:31:56Z',
'terminatedBy' => '<string>',
'terminationReason' => '<string>',
'autoCharge' => true,
'taxExempt' => true,
'minimumAccountBalance' => '<string>',
'renewalReminderEnabled' => true,
'renewalReminderDays' => 15,
'paymentTermDays' => 182
]),
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}"
payload := strings.NewReader("{\n \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\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://api.paygentic.io/v0/subscriptions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/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 \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_z1a2b3c4d5e6f7g8",
"object": "subscription",
"versionPolicy": "floating",
"autoCharge": true,
"taxExempt": false,
"createdAt": "2024-01-10T08:00:00Z",
"customerId": "cus_q3r4s5t6u7v8w9x0",
"endingAt": "2024-12-31T23:59:59Z",
"estimatedTaxRate": 8.5,
"name": "StartupXYZ - Image Generation Service",
"payment": null,
"planId": "plan_t9u0v1w2x3y4z5a6",
"startedAt": "2024-01-10T08:00:00Z",
"elapsedPeriodBilling": "none",
"billingStartsAt": "2024-01-10T08:00:00Z",
"billingAnchor": "2024-01-10T08:00:00Z",
"billingCadence": "P1M",
"status": "active",
"terminatedAt": null,
"terminatedBy": null,
"terminationReason": null,
"updatedAt": "2024-03-15T10:30:00Z"
}{
"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"
}Update
curl --request PATCH \
--url https://api.paygentic.io/v0/subscriptions/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endingAt": "2023-11-07T05:31:56Z",
"status": "terminated",
"terminatedAt": "2023-11-07T05:31:56Z",
"terminatedBy": "<string>",
"terminationReason": "<string>",
"autoCharge": true,
"taxExempt": true,
"minimumAccountBalance": "<string>",
"renewalReminderEnabled": true,
"renewalReminderDays": 15,
"paymentTermDays": 182
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}"
payload = {
"endingAt": "2023-11-07T05:31:56Z",
"status": "terminated",
"terminatedAt": "2023-11-07T05:31:56Z",
"terminatedBy": "<string>",
"terminationReason": "<string>",
"autoCharge": True,
"taxExempt": True,
"minimumAccountBalance": "<string>",
"renewalReminderEnabled": True,
"renewalReminderDays": 15,
"paymentTermDays": 182
}
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({
endingAt: '2023-11-07T05:31:56Z',
status: 'terminated',
terminatedAt: '2023-11-07T05:31:56Z',
terminatedBy: '<string>',
terminationReason: '<string>',
autoCharge: true,
taxExempt: true,
minimumAccountBalance: '<string>',
renewalReminderEnabled: true,
renewalReminderDays: 15,
paymentTermDays: 182
})
};
fetch('https://api.paygentic.io/v0/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://api.paygentic.io/v0/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([
'endingAt' => '2023-11-07T05:31:56Z',
'status' => 'terminated',
'terminatedAt' => '2023-11-07T05:31:56Z',
'terminatedBy' => '<string>',
'terminationReason' => '<string>',
'autoCharge' => true,
'taxExempt' => true,
'minimumAccountBalance' => '<string>',
'renewalReminderEnabled' => true,
'renewalReminderDays' => 15,
'paymentTermDays' => 182
]),
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}"
payload := strings.NewReader("{\n \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\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://api.paygentic.io/v0/subscriptions/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/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 \"endingAt\": \"2023-11-07T05:31:56Z\",\n \"status\": \"terminated\",\n \"terminatedAt\": \"2023-11-07T05:31:56Z\",\n \"terminatedBy\": \"<string>\",\n \"terminationReason\": \"<string>\",\n \"autoCharge\": true,\n \"taxExempt\": true,\n \"minimumAccountBalance\": \"<string>\",\n \"renewalReminderEnabled\": true,\n \"renewalReminderDays\": 15,\n \"paymentTermDays\": 182\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_z1a2b3c4d5e6f7g8",
"object": "subscription",
"versionPolicy": "floating",
"autoCharge": true,
"taxExempt": false,
"createdAt": "2024-01-10T08:00:00Z",
"customerId": "cus_q3r4s5t6u7v8w9x0",
"endingAt": "2024-12-31T23:59:59Z",
"estimatedTaxRate": 8.5,
"name": "StartupXYZ - Image Generation Service",
"payment": null,
"planId": "plan_t9u0v1w2x3y4z5a6",
"startedAt": "2024-01-10T08:00:00Z",
"elapsedPeriodBilling": "none",
"billingStartsAt": "2024-01-10T08:00:00Z",
"billingAnchor": "2024-01-10T08:00:00Z",
"billingCadence": "P1M",
"status": "active",
"terminatedAt": null,
"terminatedBy": null,
"terminationReason": null,
"updatedAt": "2024-03-15T10:30:00Z"
}{
"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
Payment term in days ("Net X") applied to subsequently generated invoices: invoice dueAt = invoice issue date + paymentTermDays. A non-zero value is only valid on a subscription created with metadata.bankTransferOnly: true. Set 0 for "due on issue". Already-issued invoices keep their snapshotted dueAt.
0 <= x <= 365How the subscription follows new versions of its plan. floating follows the plan's default version: when the default changes, the subscription bills from the new default from its next billing period. pinned keeps the plan version that the subscription holds. A subscription created without a value is floating. A change to this value does not change a billing period that has already started.
floating, pinned Response
Subscription updated
How the subscription follows new versions of its plan. floating follows the plan's default version: when the default changes, the subscription bills from the new default from its next billing period. pinned keeps the plan version that the subscription holds. A subscription created without a value is floating. A change to this value does not change a billing period that has already started.
floating, pinned Whether this subscription's backdated start bills its elapsed periods, as chosen at creation. null for a subscription created before the choice existed. null is listed in the enum as well as via nullable because the response validator checks the enum independently.
none, per_period, null Payment term in days ("Net X") snapshotted onto every invoice the subscription generates (invoice dueAt = invoice issue date + paymentTermDays). Defaults to 0 ("due on issue"); a non-zero value is only set on a subscription created with metadata.bankTransferOnly: true.
0 <= x <= 365Was this page helpful?