Cancel Subscription
curl --request PATCH \
--url https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel \
--header 'X-API-KEY: <api-key>'import requests
url = "https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel"
headers = {"X-API-KEY": "<api-key>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/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://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"X-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"
"net/http"
"io"
)
func main() {
url := "https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{}{
"error": true,
"message": "Invalid subscription ID format or missing required parameters."
}{
"error": true,
"message": "API key provided doesn't have the required scopes or is invalid."
}{
"error": true,
"message": "Subscription not found or has already been cancelled."
}{
"error": true,
"message": "Service is temporarily unavailable. Please try again later or contact support if the issue persists."
}Cancel Subscription
Cancel an existing subscription, which stops recurring payments for the specified token. The token will remain active until the end of the billing period.
API scope required: subscriptions.update
PATCH
/
2022-06-09
/
subscriptions
/
{subscriptionLocator}
/
cancel
Cancel Subscription
curl --request PATCH \
--url https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel \
--header 'X-API-KEY: <api-key>'import requests
url = "https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel"
headers = {"X-API-KEY": "<api-key>"}
response = requests.patch(url, headers=headers)
print(response.text)const options = {method: 'PATCH', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/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://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"X-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"
"net/http"
"io"
)
func main() {
url := "https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.crossmint.com/api/2022-06-09/subscriptions/{subscriptionLocator}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{}{
"error": true,
"message": "Invalid subscription ID format or missing required parameters."
}{
"error": true,
"message": "API key provided doesn't have the required scopes or is invalid."
}{
"error": true,
"message": "Subscription not found or has already been cancelled."
}{
"error": true,
"message": "Service is temporarily unavailable. Please try again later or contact support if the issue persists."
}Authorizations
Obtained in the Crossmint developer console
Path Parameters
The unique identifier for the subscription, formatted as chain:contractAddress:tokenId.
This locator references the specific token associated with the subscription.
Example:
"base:0x1234567890123456789012345678901234567890:1"
Response
Subscription successfully cancelled.
The response is of type object.
Was this page helpful?

