Membership Contracts
Cancel a membership contract
Permanently cancels an active membership contract in Shopify. This operation stops all future billing and marks the membership as CANCELLED.
Important Notes:
- Permanent Action: Cancellation cannot be undone. A new membership must be created to re-subscribe.
- Email Notification: Cancellation email is automatically sent to the customer
- Activity Logging: Cancellation is logged with reason/feedback for analytics
- Immediate Effect: No future billing attempts will be made
Customer Portal Restrictions: When called from customer portal, additional validations apply:
- Minimum Cycles: Cannot cancel if membership hasn’t completed minimum required billing cycles
- Frozen Memberships: Cannot cancel memberships that are frozen until min cycle completion
- Attribute-Based Limits: Respects any custom attribute-based cancellation restrictions
Cancellation Feedback:
- Optional
cancellationFeedbackparameter to capture why customer is cancelling - Common values: ‘TOO_EXPENSIVE’, ‘NO_LONGER_NEEDED’, ‘SWITCHING_TO_COMPETITOR’, ‘OTHER’
- Helps merchants understand churn reasons
Use Cases:
- Customer requests to cancel their membership
- Merchant manually cancels membership (e.g., payment issues, customer request)
- Automated cancellation after max cycles reached
Authentication: Requires authenticated shop user or customer portal token
DELETE
/
memberships
/
cp
/
api
/
subscription-contracts
/
{id}
Cancel a membership contract
curl --request DELETE \
--url https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}import requests
url = "https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}';
const options = {method: 'DELETE'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_bodyPath Parameters
Membership contract ID to cancel
Query Parameters
Optional cancellation reason/feedback from customer
Optional cancellation note with additional details
Response
Membership successfully cancelled (no content returned). Cancellation email sent to customer.
⌘I
Cancel a membership contract
curl --request DELETE \
--url https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}import requests
url = "https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}';
const options = {method: 'DELETE'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$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://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://www.myshop.com/apps/memberships/cp/api/subscription-contracts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body