Cancel subscription
curl --request POST \
--url https://api.kajabi.com/v1/purchases/{id}/cancel_subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.kajabi.com/v1/purchases/{id}/cancel_subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.kajabi.com/v1/purchases/{id}/cancel_subscription', 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.kajabi.com/v1/purchases/{id}/cancel_subscription",
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.kajabi.com/v1/purchases/{id}/cancel_subscription"
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.kajabi.com/v1/purchases/{id}/cancel_subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kajabi.com/v1/purchases/{id}/cancel_subscription")
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": {
"id": "<string>",
"type": "purchases",
"attributes": {
"amount_in_cents": 123,
"payment_type": "<string>",
"multipay_payments_made": 123,
"opt_in": true,
"raw_extra_contact_information": {},
"currency": "<string>",
"effective_start_at": "<string>",
"cardholder_name": "<string>",
"billing_address_zip": "<string>",
"deactivated_at": "<string>",
"deactivation_reason": "<string>",
"coupon_code": "<string>",
"source": "<string>",
"referrer": "<string>",
"quantity": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"offer": {
"data": {
"id": "<string>",
"type": "<string>"
}
},
"customer": {
"data": {
"id": "<string>",
"type": "<string>"
}
},
"transactions": {
"data": [
{
"id": "<string>",
"type": "<string>"
}
]
},
"products": {
"data": [
{
"id": "<string>",
"type": "<string>"
}
]
}
}
},
"links": {
"self": "<string>",
"current": "<string>"
}
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}Purchases
Cancel subscription
Cancel the subscription associated with a purchase by ID
This endpoint cancels the underlying subscription (Stripe, PayPal, or Kajabi Payments) associated with the purchase. The purchase will be deactivated and the subscription will be cancelled immediately, according to the payment provider’s cancellation rules.
If the payment can be cancelled the response will be successful. Otherwise, the response will be an error with validation details.
POST
/
v1
/
purchases
/
{id}
/
cancel_subscription
Cancel subscription
curl --request POST \
--url https://api.kajabi.com/v1/purchases/{id}/cancel_subscription \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.kajabi.com/v1/purchases/{id}/cancel_subscription"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.kajabi.com/v1/purchases/{id}/cancel_subscription', 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.kajabi.com/v1/purchases/{id}/cancel_subscription",
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.kajabi.com/v1/purchases/{id}/cancel_subscription"
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.kajabi.com/v1/purchases/{id}/cancel_subscription")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kajabi.com/v1/purchases/{id}/cancel_subscription")
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": {
"id": "<string>",
"type": "purchases",
"attributes": {
"amount_in_cents": 123,
"payment_type": "<string>",
"multipay_payments_made": 123,
"opt_in": true,
"raw_extra_contact_information": {},
"currency": "<string>",
"effective_start_at": "<string>",
"cardholder_name": "<string>",
"billing_address_zip": "<string>",
"deactivated_at": "<string>",
"deactivation_reason": "<string>",
"coupon_code": "<string>",
"source": "<string>",
"referrer": "<string>",
"quantity": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"relationships": {
"offer": {
"data": {
"id": "<string>",
"type": "<string>"
}
},
"customer": {
"data": {
"id": "<string>",
"type": "<string>"
}
},
"transactions": {
"data": [
{
"id": "<string>",
"type": "<string>"
}
]
},
"products": {
"data": [
{
"id": "<string>",
"type": "<string>"
}
]
}
}
},
"links": {
"self": "<string>",
"current": "<string>"
}
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}{
"errors": [
{
"status": "<string>",
"source": {
"pointer": "<string>"
},
"title": "<string>",
"detail": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Purchase ID
Was this page helpful?
⌘I