Cancel agreement
Cancels a payment agreement and all its future payments. The account holder is notified.
Parameters
Send as application/x-www-form-urlencoded.
typestringrequiredSelects the operation. Always
cancel_payment_planfor this endpoint.tokenstringrequiredYour API token from Log in. See Authentication.
Your DCDial company ID.
Example101ID of the payment agreement.
Example5521
curl https://api.dcdial.com/api/ \ -d type=cancel_payment_plan \ -d token="$DCDIAL_TOKEN" \ -d company_id=101 \ -d agreement_id=5521<?php$ch = curl_init('https://api.dcdial.com/api/');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => http_build_query([ 'type' => 'cancel_payment_plan', 'token' => getenv('DCDIAL_TOKEN'), 'company_id' => 101, 'agreement_id' => 5521, ]),]);$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (($result['response']['success'] ?? 0) != 1) { throw new RuntimeException($result['response']['error'] ?? 'Request failed');}const res = await fetch('https://api.dcdial.com/api/', { method: 'POST', body: new URLSearchParams({ type: "cancel_payment_plan", token: process.env.DCDIAL_TOKEN, company_id: "101", agreement_id: "5521", }),});const { response } = await res.json();if (response.success != 1) throw new Error(response.error);import osimport requests
r = requests.post( "https://api.dcdial.com/api/", data={ "type": "cancel_payment_plan", "token": os.environ["DCDIAL_TOKEN"], "company_id": 101, "agreement_id": 5521, }, timeout=30,)response = r.json()["response"]if str(response.get("success")) != "1": raise RuntimeError(response.get("error")){ "response": { "agreement_id": "12345", "message": "", "success": "[1|0]" }}Try it