Cancel Subscription
curl --request PATCH \
--url https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "customer_request"
}
'import requests
url = "https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel"
payload = { "reason": "customer_request" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'customer_request'})
};
fetch('https://api.payaza.africa/live/subscription/api/v1/subscriptions/{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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'customer_request'
]),
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://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": \"customer_request\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"customer_request\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"customer_request\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Subscription cancelled",
"data": {
"id": 22,
"customerId": "test-trial-2",
"customerEmail": "johndoe@gmail.com",
"status": "CANCELLED",
"enrollmentReference": "SUBREF_EE9A8CD25F38423B87",
"enrollmentTxnReference": "SUB_ENROLL_22_1783543549106",
"cancelledAt": "2026-07-08T22:07:36.154580616",
"cancellationReason": "customer_request"
}
}Subscription Lifecycle
Cancel Subscription
This endpoint permanently cancels a subscription. Once cancelled, no further recurring charges will be attempted.
Note:
- Cancelling a subscription is a terminal action. Once cancelled, future billing stops immediately and
nextChargeDateis cleared.
PATCH
/
subscription
/
api
/
v1
/
subscriptions
/
{id}
/
cancel
Cancel Subscription
curl --request PATCH \
--url https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "customer_request"
}
'import requests
url = "https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel"
payload = { "reason": "customer_request" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: 'customer_request'})
};
fetch('https://api.payaza.africa/live/subscription/api/v1/subscriptions/{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.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'reason' => 'customer_request'
]),
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://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": \"customer_request\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"customer_request\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.payaza.africa/live/subscription/api/v1/subscriptions/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"customer_request\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Subscription cancelled",
"data": {
"id": 22,
"customerId": "test-trial-2",
"customerEmail": "johndoe@gmail.com",
"status": "CANCELLED",
"enrollmentReference": "SUBREF_EE9A8CD25F38423B87",
"enrollmentTxnReference": "SUB_ENROLL_22_1783543549106",
"cancelledAt": "2026-07-08T22:07:36.154580616",
"cancellationReason": "customer_request"
}
}Authorizations
Payaza {{Public API Key in Base 64}}
Path Parameters
The ID of the subscription.
Body
application/json
The reason for cancelling this subscription.
Example:
"Not interested"
⌘I