curl --request POST \
--url https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel', 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.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"attributes": {
"amount": 123,
"contact_id": "<string>",
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"external_subscription_id": "<string>",
"hub_id": "<string>",
"interval": "<string>",
"interval_count": 123,
"payment_account_id": "<string>",
"payment_customer_id": "<string>",
"plan_description": "<string>",
"plan_name": "<string>",
"price_id": "<string>",
"price_name": "<string>",
"price_type": "<string>",
"product_id": "<string>",
"status": "<string>",
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": false,
"canceled_at": "2023-11-07T05:31:56Z",
"collection_paused": false,
"created_at": "2023-11-07T05:31:56Z",
"deliverables_snapshot": [],
"last_payment_failed_amount": 123,
"last_payment_failed_at": "2023-11-07T05:31:56Z",
"last_payment_failed_currency": "<string>",
"origin_order_id": "<string>",
"payment_update_needed": false,
"source": "native",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"id": "<string>",
"type": "subscriptions"
}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}Cancel subscription (Phase A: at-period-end only)
curl --request POST \
--url https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel', 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.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.member.dev/api/v1/teams/{team_id}/hubs/{hub_id}/subscriptions/{sub_id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"attributes": {
"amount": 123,
"contact_id": "<string>",
"currency": "<string>",
"current_period_end": "2023-11-07T05:31:56Z",
"current_period_start": "2023-11-07T05:31:56Z",
"external_subscription_id": "<string>",
"hub_id": "<string>",
"interval": "<string>",
"interval_count": 123,
"payment_account_id": "<string>",
"payment_customer_id": "<string>",
"plan_description": "<string>",
"plan_name": "<string>",
"price_id": "<string>",
"price_name": "<string>",
"price_type": "<string>",
"product_id": "<string>",
"status": "<string>",
"cancel_at": "2023-11-07T05:31:56Z",
"cancel_at_period_end": false,
"canceled_at": "2023-11-07T05:31:56Z",
"collection_paused": false,
"created_at": "2023-11-07T05:31:56Z",
"deliverables_snapshot": [],
"last_payment_failed_amount": 123,
"last_payment_failed_at": "2023-11-07T05:31:56Z",
"last_payment_failed_currency": "<string>",
"origin_order_id": "<string>",
"payment_update_needed": false,
"source": "native",
"trial_end": "2023-11-07T05:31:56Z",
"trial_start": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"id": "<string>",
"type": "subscriptions"
}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}{
"errors": [
{
"status": "<string>",
"title": "<string>",
"code": "<string>",
"detail": "<string>",
"id": "<string>",
"meta": {},
"source": {}
}
],
"meta": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Optional. Makes a retry of the same action safe. Send a new random value (e.g. a UUID) for each user action and repeat it on retries of that action. A repeat with the same key and the same request returns the first response (same status and body) and does nothing else: no second Stripe call, ledger write or event. A concurrent repeat waits for the first request and then returns its response. The key is scoped to the team, the acting user, the operation and the target resource; reusing it on another resource is a new request. Errors: 422 idempotency_key_invalid (blank or over 255 characters); 409 idempotency_key_conflict (the key was already used with a different request); 409 idempotency_request_in_progress (Stripe still processing an earlier request with this key; retry later with the same key). A request that fails with an error stores nothing, so the same key can be retried. Refund and cancel keys are kept permanently; webhook-replay keys expire after 24 hours. Without the header the route behaves as before.
Response
Successful Response
Show child attributes
Show child attributes