Create mandate

Mandates API v2
POSThttps://api.mollie.com/v2/customers/*customerId*/mandates

Create a mandate for a specific customer. Mandates allow you to charge a customer’s credit card or bank account recurrently.

It is only possible to create mandates for IBANs with this endpoint. To create mandates for credit cards, have your customers perform a ‘first payment’ with their credit card.

Note

Created mandates are unique to your account and can not be transferred to other accounts.

Parameters

Replace customerId in the endpoint URL by the customer’s ID, for example /v2/customers/cst_8wmqcHMN4U/mandates.

method

string
required

Payment method of the mandate.

Possible values: directdebit

consumerName

string
required
The consumer’s name.

consumerAccount

string
required
The consumer’s IBAN.

consumerBic

string
optional
The consumer’s bank’s BIC.

signatureDate

date
optional
The date when the mandate was signed in YYYY-MM-DD format.

mandateReference

string
optional
A custom mandate reference. Use an unique mandateReference as some banks decline a Direct Debit payment if the mandateReference is not unique.

Access token parameters

If you are using organization access tokens or are creating an OAuth app, the testmode parameter is also available.

testmode

boolean
optional
Set this to true to create a test mode mandate.

Response

201 application/json

A mandate object is returned, as described in Get mandate.

Example

cURLPHPPythonRubyNode.js
1
2
3
4
5
6
7
8
curl -X POST https://api.mollie.com/v2/customers/cst_4qqhO89gsT/mandates \
   -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \
   -d "method=directdebit" \
   -d "consumerName=John Doe" \
   -d "consumerAccount=NL55INGB0000000000" \
   -d "consumerBic=INGBNL2A" \
   -d "signatureDate=2018-05-07" \
   -d "mandateReference=YOUR-COMPANY-MD13804"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
$mandate = $mollie->customers->get("cst_4qqhO89gsT")->createMandate([
   "method" => \Mollie\Api\Types\MandateMethod::DIRECTDEBIT,
   "consumerName" => "John Doe",
   "consumerAccount" => "NL55INGB0000000000",
   "consumerBic" => "INGBNL2A",
   "signatureDate" => "2018-05-07",
   "mandateReference" => "YOUR-COMPANY-MD13804",
]);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
require 'mollie-api-ruby'

Mollie::Client.configure do |config|
  config.api_key = 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'
end

mandate = Mollie::Customer::Mandate.create(
  customer_id:       'cst_4qqhO89gsT',
  method:            'directdebit',
  consumer_name:     'John Doe',
  consumer_account:  'NL55INGB0000000000',
  consumer_bic:      'INGBNL2A',
  signature_date:    '2018-05-07',
  mandate_reference: 'YOUR-COMPANY-MD13804'
)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
const { createMollieClient } = require('@mollie/api-client');
const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });

(async () => {
  const mandate = await mollieClient.customers_mandates.create({
    customerId: 'cst_4qqhO89gsT',
    method: 'directdebit',
    consumerName: 'John Doe',
    consumerAccount: 'NL55INGB0000000000',
    consumerBic: 'INGBNL2A',
    signatureDate: '2018-05-07',
    mandateReference: 'YOUR-COMPANY-MD13804',
  });
})();
1
2
3
4
We don't have a Python code example for this API call yet.

If you have some time to spare, feel free to open a pull request at:
https://github.com/mollie/api-documentation

Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
HTTP/1.1 201 Created
Content-Type: application/json

{
    "resource": "mandate",
    "id": "mdt_h3gAaD5zP",
    "mode": "test",
    "status": "valid",
    "method": "directdebit",
    "details": {
        "consumerName": "John Doe",
        "consumerAccount": "NL55INGB0000000000",
        "consumerBic": "INGBNL2A"
    },
    "mandateReference": "YOUR-COMPANY-MD13804",
    "signatureDate": "2018-05-07",
    "createdAt": "2018-05-07T10:49:08+00:00",
    "_links": {
        "self": {
            "href": "https://api.mollie.com/v2/customers/cst_4qqhO89gsT/mandates/mdt_h3gAaD5zP",
            "type": "application/hal+json"
        },
        "customer": {
            "href": "https://api.mollie.com/v2/customers/cst_4qqhO89gsT",
            "type": "application/hal+json"
        },
        "documentation": {
            "href": "https://docs.mollie.com/reference/v2/mandates-api/create-mandate",
            "type": "text/html"
        }
    }
}