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, PayPal account or bank account recurrently.

It is only possible to create mandates for IBANs and PayPal billing agreements 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.

methodstringrequired

Payment method of the mandate.

SEPA Direct Debit and PayPal mandates can be created directly.

Possible values: directdebit paypal

consumerNamestringrequired
The consumer’s name.
consumerAccountstringconditional
The consumer’s IBAN. Required for directdebit mandates.
consumerBicstringoptional
The consumer’s bank’s BIC.
consumerEmailstringconditional
The consumer’s email address. Required for paypal mandates.
signatureDatedateoptional
The date when the mandate was signed in YYYY-MM-DD format.
mandateReferencestringoptional
A custom mandate reference. Use an unique mandateReference as some banks decline a Direct Debit payment if the mandateReference is not unique.
paypalBillingAgreementIdstringconditional
The billing agreement ID given by PayPal. For example: B-12A34567B8901234CD. Required for paypal mandates.

Access token parameters

If you are using organization access tokens or are creating an OAuth app, you can enable test mode through the testmode parameter.

testmodebooleanoptional

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
from mollie.api.client import Client

mollie_client = Client()
mollie_client.set_api_key("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM")

customer = mollie_client.customers.get("cst_4qqhO89gsT")
mandate = customer.mandates.create({
    "method": "directdebit",
    "consumerName": "John Doe",
    "consumerAccount": "NL55INGB0000000000",
    "consumerBic": "INGBNL2A",
    "signatureDate": "2020-04-23",
    "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
const { createMollieClient } = require('@mollie/api-client');
const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });

const mandate = await mollieClient.customerMandates.create({
  customerId: 'cst_4qqhO89gsT',
  method: 'directdebit',
  consumerName: 'John Doe',
  consumerAccount: 'NL55INGB0000000000',
  consumerBic: 'INGBNL2A',
  signatureDate: '2018-05-07',
  mandateReference: 'YOUR-COMPANY-MD13804'
});

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"
        }
    }
}