curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/termination \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/termination"
payload = { "reason": "<string>" }
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({reason: '<string>'})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/termination', 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}/termination",
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([
'reason' => '<string>'
]),
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}/termination"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\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}/termination")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/termination")
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 \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_z1a2b3c4d5e6f7g8",
"object": "subscription",
"versionPolicy": "floating",
"autoCharge": false,
"taxExempt": false,
"createdAt": "2024-01-10T08:00:00Z",
"customerId": "cus_q3r4s5t6u7v8w9x0",
"endingAt": null,
"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": "terminated",
"terminatedAt": "2024-03-15T14:20:00Z",
"terminatedBy": "org_f7g8h9i0j1k2l3m4",
"terminationReason": "Customer requested cancellation",
"updatedAt": "2024-03-15T14:20: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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Terminate
Terminates a subscription with a required reason. This endpoint is for merchant-initiated termination only.
curl --request POST \
--url https://api.paygentic.io/v0/subscriptions/{id}/termination \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.paygentic.io/v0/subscriptions/{id}/termination"
payload = { "reason": "<string>" }
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({reason: '<string>'})
};
fetch('https://api.paygentic.io/v0/subscriptions/{id}/termination', 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}/termination",
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([
'reason' => '<string>'
]),
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}/termination"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\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}/termination")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptions/{id}/termination")
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 \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "sub_z1a2b3c4d5e6f7g8",
"object": "subscription",
"versionPolicy": "floating",
"autoCharge": false,
"taxExempt": false,
"createdAt": "2024-01-10T08:00:00Z",
"customerId": "cus_q3r4s5t6u7v8w9x0",
"endingAt": null,
"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": "terminated",
"terminatedAt": "2024-03-15T14:20:00Z",
"terminatedBy": "org_f7g8h9i0j1k2l3m4",
"terminationReason": "Customer requested cancellation",
"updatedAt": "2024-03-15T14:20: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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Body
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
Subscription terminated successfully
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 valid on any subscription, whatever its payment method.
0 <= x <= 365Was this page helpful?