Cancel Mandate
curl --request POST \
--url https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requestId": "69383ce4f8b5a8e2077df9c7"
}
'import requests
url = "https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel"
payload = { "requestId": "69383ce4f8b5a8e2077df9c7" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({requestId: '69383ce4f8b5a8e2077df9c7'})
};
fetch('https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/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.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'requestId' => '69383ce4f8b5a8e2077df9c7'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel"
payload := strings.NewReader("{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}"
response = http.request(request)
puts response.read_body{
"mandateRequestId": "69383ce4f8b5a8e2077df9c7",
"mandateStatus": "CANCELLED",
"paymentsTotalAmount": 27500,
"paymentsInstallments": 11
}{
"statusCode": 400,
"message": [
"Cannot cancel CRDB direct debit mandate. Mandate must be ACTIVE to cancel. Current status: REQUESTED"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized",
"error": "Unauthorized"
}{
"error": "CRDB direct debit mandate not found"
}CRDB DIRECT DEBIT
Cancel Mandate
Cancel an ACTIVE CRDB Direct Debit mandate. When the linked payment plan is still active, the plan and unpaid cycles are cancelled too.
POST
/
customers
/
crdb-direct-debit-mandate
/
cancel
Cancel Mandate
curl --request POST \
--url https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requestId": "69383ce4f8b5a8e2077df9c7"
}
'import requests
url = "https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel"
payload = { "requestId": "69383ce4f8b5a8e2077df9c7" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({requestId: '69383ce4f8b5a8e2077df9c7'})
};
fetch('https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/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.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'requestId' => '69383ce4f8b5a8e2077df9c7'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel"
payload := strings.NewReader("{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.clickpesa.com/third-parties/customers/crdb-direct-debit-mandate/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"requestId\": \"69383ce4f8b5a8e2077df9c7\"\n}"
response = http.request(request)
puts response.read_body{
"mandateRequestId": "69383ce4f8b5a8e2077df9c7",
"mandateStatus": "CANCELLED",
"paymentsTotalAmount": 27500,
"paymentsInstallments": 11
}{
"statusCode": 400,
"message": [
"Cannot cancel CRDB direct debit mandate. Mandate must be ACTIVE to cancel. Current status: REQUESTED"
],
"error": "Bad Request"
}{
"statusCode": 401,
"message": "Unauthorized",
"error": "Unauthorized"
}{
"error": "CRDB direct debit mandate not found"
}Only mandates with status ACTIVE can be cancelled. See the CRDB Direct Debit API overview.
Authorizations
Bearer token from Generate Authorization Token
Body
application/json
The mandateRequestId returned when the mandate was requested
Example:
"69383ce4f8b5a8e2077df9c7"
⌘I

