Update subscription
curl --request POST \
--url https://test-api.stash.gg/sdk/subscriptions/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "<string>"
}
'import requests
url = "https://test-api.stash.gg/sdk/subscriptions/{id}"
payload = { "idempotencyKey": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({idempotencyKey: '<string>'})
};
fetch('https://test-api.stash.gg/sdk/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://test-api.stash.gg/sdk/subscriptions/{id}",
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([
'idempotencyKey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://test-api.stash.gg/sdk/subscriptions/{id}"
payload := strings.NewReader("{\n \"idempotencyKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://test-api.stash.gg/sdk/subscriptions/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.stash.gg/sdk/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotencyKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"externalAccountId": "<string>",
"planId": "<string>",
"status": "<string>",
"period": {
"value": 123,
"unit": "<string>"
},
"accessEndDate": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"nextBillingDate": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"trialEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"canceledAt": "2023-11-07T05:31:56Z",
"checkoutLinkMetadata": {},
"freePeriod": {
"type": "FREE_PERIOD_TYPE_UNSPECIFIED",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Update subscription
Applies one change to a subscription. free_period grants free billing periods that start when the current paid period ends: the subscriber keeps access, is not charged at the next renewal date, and billing resumes at the plan’s normal price when the free period ends. A scheduled cancellation is reversed. Rejections return FAILED_PRECONDITION with reason SUBSCRIPTION_NOT_ELIGIBLE, FREE_PERIOD_ALREADY_ACTIVE or RENEWAL_IN_PROGRESS. Reusing an idempotency_key with different parameters returns ALREADY_EXISTS.
POST
/
sdk
/
subscriptions
/
{id}
Update subscription
curl --request POST \
--url https://test-api.stash.gg/sdk/subscriptions/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotencyKey": "<string>"
}
'import requests
url = "https://test-api.stash.gg/sdk/subscriptions/{id}"
payload = { "idempotencyKey": "<string>" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({idempotencyKey: '<string>'})
};
fetch('https://test-api.stash.gg/sdk/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://test-api.stash.gg/sdk/subscriptions/{id}",
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([
'idempotencyKey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://test-api.stash.gg/sdk/subscriptions/{id}"
payload := strings.NewReader("{\n \"idempotencyKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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://test-api.stash.gg/sdk/subscriptions/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"idempotencyKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.stash.gg/sdk/subscriptions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotencyKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"externalAccountId": "<string>",
"planId": "<string>",
"status": "<string>",
"period": {
"value": 123,
"unit": "<string>"
},
"accessEndDate": "2023-11-07T05:31:56Z",
"currentPeriodEnd": "2023-11-07T05:31:56Z",
"nextBillingDate": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"trialEnd": "2023-11-07T05:31:56Z",
"cancelAtPeriodEnd": true,
"canceledAt": "2023-11-07T05:31:56Z",
"checkoutLinkMetadata": {},
"freePeriod": {
"type": "FREE_PERIOD_TYPE_UNSPECIFIED",
"startsAt": "2023-11-07T05:31:56Z",
"endsAt": "2023-11-07T05:31:56Z"
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Authorizations
bearerAuthhmacdeprecatedApiKey
Body
application/json
Response
A successful response.