PUT
/
v2.01
/
{ClientId}
/
mandates
/
{MandateId}
/
cancel
<?php 

require_once 'vendor/autoload.php';

use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;

$api = new MangoPayApi();

$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';

try {
    $mandateId = '199255586';

    $response = $api->Mandates->Cancel($mandateId);

    print_r($response);
} catch(MGPResponseException $e) {
    print_r($e);
} catch(MGPException $e) {
    print_r($e);
}  
{
    "Scheme": "SEPA",
    "BankAccountId": "bankacc_m_01J999AWHFHW2PQ1ADNQ46AYE9",
    "BankReference": "QYDZMNP",
    "Culture": "EN",
    "DocumentURL": "https://api.sandbox.mangopay.com/webhook/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/document?version=2.01",
    "ReturnURL": "https://docs.mangopay.com/please-ignore?MandateId=mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
    "RedirectURL": "https://api.sandbox.mangopay.com/mvc/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/confirmation?version=2.01",
    "Id": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
    "CreationDate": 1727962392,
    "Status": "FAILED",,
    "UserId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T",
    "ExecutionType": "WEB",
    "MandateType": "DIRECT_DEBIT",
    "Tag": "Created using the Mangopay API Postman collection",
    "ResultCode": "001806",
    "ResultMessage": "The client has cancelled the mandate"
}

Warning – Call requires Content-Length adjustment

For this call to succeed, you need to define the header Content-Length to 0.

Path parameters

MandateId
string
required

The unique identifier of the mandate.

Responses

{
    "Scheme": "SEPA",
    "BankAccountId": "bankacc_m_01J999AWHFHW2PQ1ADNQ46AYE9",
    "BankReference": "QYDZMNP",
    "Culture": "EN",
    "DocumentURL": "https://api.sandbox.mangopay.com/webhook/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/document?version=2.01",
    "ReturnURL": "https://docs.mangopay.com/please-ignore?MandateId=mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
    "RedirectURL": "https://api.sandbox.mangopay.com/mvc/eu/public/mandates/e8a73d/dfbdce2a12a442bfae973e56777b3ddb/confirmation?version=2.01",
    "Id": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ",
    "CreationDate": 1727962392,
    "Status": "FAILED",,
    "UserId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T",
    "ExecutionType": "WEB",
    "MandateType": "DIRECT_DEBIT",
    "Tag": "Created using the Mangopay API Postman collection",
    "ResultCode": "001806",
    "ResultMessage": "The client has cancelled the mandate"
}
<?php 

require_once 'vendor/autoload.php';

use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;

$api = new MangoPayApi();

$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';

try {
    $mandateId = '199255586';

    $response = $api->Mandates->Cancel($mandateId);

    print_r($response);
} catch(MGPResponseException $e) {
    print_r($e);
} catch(MGPException $e) {
    print_r($e);
}