Mandates
Cancel Mandate
Cancel an active mandate, stopping all future collections
Cancel an active mandate, preventing any further collections against it.
Endpoint
POST /api/mandates/{mandate_id}/cancel
Authentication: Required (API Key)
Important Restrictions
- Only mandates with status
activecan be cancelled - Cancellation is permanent. It cannot be undone.
Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
mandate_id | integer | Yes | The NjiaPay internal mandate ID |
Example Request
curl -X POST "https://api.njiapay.com/api/mandates/42/cancel" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://api.njiapay.com/api/mandates/42/cancel",
{
method: "POST",
headers: { Authorization: `Bearer ${YOUR_API_KEY}` },
},
);
if (response.status === 204) {
console.log("Mandate cancelled successfully");
}
import requests
response = requests.post(
"https://api.njiapay.com/api/mandates/42/cancel",
headers={"Authorization": f"Bearer {YOUR_API_KEY}"},
)
if response.status_code == 204:
print("Mandate cancelled successfully")
Response
Success (204 No Content)
No body is returned on success.
Error Responses
403 Forbidden
{
"detail": "Mandate does not belong to this merchant"
}
404 Not Found
{
"detail": "No active mandate found for this reference_id"
}
502 Bad Gateway
{
"detail": "Mandate cancellation failed at payment provider"
}
Causes:
- The payment provider returned an error or is unreachable.