Change the expiration date
curl --request POST \
--url https://api.beta.suby.fi/v3/subscriptions/{id}/period-end \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"allowShorten": false
}
'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}/period-end"
payload = {
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"allowShorten": False
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({currentCycleDueAt: '2023-11-07T05:31:56Z', allowShorten: false})
};
fetch('https://api.beta.suby.fi/v3/subscriptions/{id}/period-end', 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.beta.suby.fi/v3/subscriptions/{id}/period-end",
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([
'currentCycleDueAt' => '2023-11-07T05:31:56Z',
'allowShorten' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-Key: <api-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.beta.suby.fi/v3/subscriptions/{id}/period-end"
payload := strings.NewReader("{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}/period-end")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}/period-end")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"subscription": {
"id": "sub_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"status": "INCOMPLETE",
"currentCycle": 123,
"totalCycles": 123,
"trialEndAt": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"renewalAttempt": 123,
"nextRenewalAttemptAt": "2023-11-07T05:31:56Z",
"lastDeclineCategory": "SOFT",
"priceCents": "1999",
"currency": "EUR",
"quantity": 3,
"taxInclusive": true,
"purchaseAsBusiness": true,
"externalRef": "<string>",
"endedAt": "2023-11-07T05:31:56Z",
"endReason": "CANCELED_BY_CUSTOMER",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"product": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY",
"adjustableQuantity": true,
"adjustableMin": 123,
"adjustableMax": 123
},
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com"
}
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Subscriptions
Change the expiration date
Move the end of the current paid period of an ACTIVE subscription · access and
the next renewal both follow. Fires subscription.updated.
The date must be in the future. A date earlier than the current one requires
allowShorten: true.
POST
/
v3
/
subscriptions
/
{id}
/
period-end
Change the expiration date
curl --request POST \
--url https://api.beta.suby.fi/v3/subscriptions/{id}/period-end \
--header 'Content-Type: application/json' \
--header 'X-Suby-Api-Key: <api-key>' \
--data '
{
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"allowShorten": false
}
'import requests
url = "https://api.beta.suby.fi/v3/subscriptions/{id}/period-end"
payload = {
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"allowShorten": False
}
headers = {
"X-Suby-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Suby-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({currentCycleDueAt: '2023-11-07T05:31:56Z', allowShorten: false})
};
fetch('https://api.beta.suby.fi/v3/subscriptions/{id}/period-end', 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.beta.suby.fi/v3/subscriptions/{id}/period-end",
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([
'currentCycleDueAt' => '2023-11-07T05:31:56Z',
'allowShorten' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Suby-Api-Key: <api-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.beta.suby.fi/v3/subscriptions/{id}/period-end"
payload := strings.NewReader("{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Suby-Api-Key", "<api-key>")
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.beta.suby.fi/v3/subscriptions/{id}/period-end")
.header("X-Suby-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beta.suby.fi/v3/subscriptions/{id}/period-end")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Suby-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currentCycleDueAt\": \"2023-11-07T05:31:56Z\",\n \"allowShorten\": false\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"subscription": {
"id": "sub_abc123",
"organizationId": "<string>",
"customerId": "<string>",
"productId": "<string>",
"status": "INCOMPLETE",
"currentCycle": 123,
"totalCycles": 123,
"trialEndAt": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"currentCycleDueAt": "2023-11-07T05:31:56Z",
"renewalAttempt": 123,
"nextRenewalAttemptAt": "2023-11-07T05:31:56Z",
"lastDeclineCategory": "SOFT",
"priceCents": "1999",
"currency": "EUR",
"quantity": 3,
"taxInclusive": true,
"purchaseAsBusiness": true,
"externalRef": "<string>",
"endedAt": "2023-11-07T05:31:56Z",
"endReason": "CANCELED_BY_CUSTOMER",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"product": {
"id": "pro_abc123",
"name": "<string>",
"description": "<string>",
"imageUrl": "<string>",
"status": "ACTIVE",
"priceCents": "<string>",
"currency": "<string>",
"recurringInterval": "DAY",
"recurringIntervalCount": 123,
"recurringCycleCount": 123,
"trialDurationCount": 123,
"trialDurationUnit": "DAY",
"adjustableQuantity": true,
"adjustableMin": 123,
"adjustableMax": 123
},
"customer": {
"id": "cus_abc123",
"email": "jsmith@example.com"
}
}
},
"message": "<string>"
}{
"success": false,
"error": "UNAUTHORIZED",
"message": "Invalid or missing API key"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}{
"success": false,
"error": "NOT_FOUND",
"message": "Resource not found",
"data": "<unknown>"
}Authorizations
Headers
Body
application/json
Was this page helpful?

