# Create mandate Create a mandate for a specific customer. Mandates allow you to charge a customer's 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 cards, your customers need to perform a 'first payment' with their card. > 🔑 Access with > > [API key](/reference/authentication) > > [Organization access token with **mandates.write**](/reference/authentication) > > [OAuth access with **mandates.write**](/reference/authentication) # OpenAPI definition ```json { "openapi": "3.1.0", "info": { "title": "Recurring", "version": "1.0.0", "license": { "name": "Attribution-NonCommercial-ShareAlike 4.0 International", "identifier": "CC-BY-NC-SA-4.0" } }, "servers": [ { "url": "https://api.mollie.com/v2" } ], "security": [ { "apiKey": [] }, { "organizationAccessToken": [] }, { "oAuth": [] } ], "paths": { "/customers/{customerId}/mandates": { "parameters": [ { "name": "customerId", "description": "Provide the ID of the related customer.", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } } ], "post": { "summary": "Create mandate", "x-speakeasy-name-override": "create", "tags": [ "Mandates API" ], "operationId": "create-mandate", "security": [ { "apiKey": [] }, { "organizationAccessToken": [ "mandates.write" ] }, { "oAuth": [ "mandates.write" ] } ], "description": "Create a mandate for a specific customer. Mandates allow you to charge a customer's card, PayPal account or bank account recurrently.\n\nIt is only possible to create mandates for IBANs and PayPal billing agreements with this endpoint. To create mandates for cards, your customers need to perform a 'first payment' with their card.\n\n> 🔑 Access with\n>\n> [API key](/reference/authentication)\n>\n> [Organization access token with **mandates.write**](/reference/authentication)\n>\n> [OAuth access with **mandates.write**](/reference/authentication)", "requestBody": { "content": { "application/json": { "schema": { "allOf": [ { "type": "object", "properties": { "resource": { "type": "string", "description": "Indicates the response contains a mandate object. Will always contain the string `mandate` for this endpoint.", "readOnly": true, "default": "mandate" }, "id": { "allOf": [ { "type": "string", "pattern": "^mdt_.+$", "example": "mdt_5B8cwPMGnU" } ], "description": "The identifier uniquely referring to this mandate. Example: `mdt_pWUnw6pkBN`." }, "mode": { "type": "string", "description": "Whether this entity was created in live mode or in test mode.\n\nPossible values: `live` `test`", "readOnly": true, "example": "live" }, "method": { "type": "string", "description": "Payment method of the mandate.\n\nSEPA Direct Debit and PayPal mandates can be created directly.\n\nPossible values: `creditcard` `directdebit` `paypal`", "example": "directdebit" }, "consumerName": { "type": "string", "description": "The customer's name.", "example": "John Doe", "writeOnly": true }, "consumerAccount": { "type": [ "string", "null" ], "description": "The customer's IBAN. Required for SEPA Direct Debit mandates.", "example": "NL55INGB0000000000", "writeOnly": true }, "consumerBic": { "type": [ "string", "null" ], "description": "The BIC of the customer's bank.", "example": "BANKBIC", "writeOnly": true }, "consumerEmail": { "type": [ "string", "null" ], "description": "The customer's email address. Required for PayPal mandates.", "example": "example@email.com", "writeOnly": true }, "details": { "type": "object", "properties": { "consumerName": { "type": [ "string", "null" ], "description": "The customer's name. Available for SEPA Direct Debit and PayPal mandates.", "example": "John Doe" }, "consumerAccount": { "type": [ "string", "null" ], "description": "The customer's IBAN or email address. Available for SEPA Direct Debit and PayPal mandates.", "example": "NL55INGB0000000000" }, "consumerBic": { "type": [ "string", "null" ], "description": "The BIC of the customer's bank. Available for SEPA Direct Debit mandates.", "example": "BANKBIC" }, "cardHolder": { "type": [ "string", "null" ], "description": "The card holder's name. Available for card mandates.", "example": "John Doe" }, "cardNumber": { "type": [ "string", "null" ], "description": "The last four digits of the card number. Available for card mandates.", "example": 3240 }, "cardExpiryDate": { "type": [ "string", "null" ], "description": "The card's expiry date in `YYYY-MM-DD` format. Available for card mandates.", "example": "2025-01-01" }, "cardLabel": { "type": [ "string", "null" ], "description": "The card's label. Available for card mandates, if the card label could be detected.\n\nPossible values: `American Express` `Carta Si` `Carte Bleue` `Dankort` `Diners Club` `Discover` `JCB` `Laser` `Maestro` `Mastercard` `Unionpay` `Visa`", "example": "Visa" }, "cardFingerprint": { "type": [ "string", "null" ], "description": "Unique alphanumeric representation of this specific card. Available for card mandates. Can be used to identify returning customers.", "example": "d3290e932k02f" } }, "readOnly": true }, "signatureDate": { "type": [ "string", "null" ], "description": "The date when the mandate was signed in `YYYY-MM-DD` format.", "example": "2025-01-01" }, "mandateReference": { "type": [ "string", "null" ], "description": "A custom mandate reference. For SEPA Direct Debit, it is vital to provide a unique reference. Some banks will decline Direct Debit payments if the mandate reference is not unique.", "example": "ID-1023892" }, "paypalBillingAgreementId": { "type": [ "string", "null" ], "description": "The billing agreement ID given by PayPal. For example: `B-12A34567B8901234CD`. Required for PayPal mandates. Must provide either this field or `payPalVaultId`, but not both.", "example": "B-12A34567B8901234CD", "writeOnly": true }, "payPalVaultId": { "type": [ "string", "null" ], "description": "The Vault ID given by PayPal. For example: `8kk8451t`. Required for PayPal mandates. Must provide either this field or `paypalBillingAgreementId`, but not both.", "example": "8kk8451t", "writeOnly": true }, "status": { "allOf": [ { "type": "string", "description": "The status of the mandate. A status can be `pending` for mandates when the first payment is not yet finalized, or when we did not received the IBAN yet from the first payment.\n\nPossible values: `valid` `pending` `invalid`", "example": "valid" } ], "readOnly": true }, "customerId": { "allOf": [ { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } ], "description": "The identifier referring to the [customer](get-customer) this mandate was linked to.", "readOnly": true }, "createdAt": { "type": "string", "description": "The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.", "readOnly": true, "example": "2024-03-20T09:13:37+00:00" }, "testmode": { "type": [ "boolean", "null" ], "description": "Whether to create the entity in test mode or live mode.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false }, "_links": { "type": "object", "description": "An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.", "required": [ "self", "customer", "documentation" ], "properties": { "self": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "customer": { "description": "The API resource URL of the [customer](get-customer) that this mandate belongs to.", "type": "object", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "documentation": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } } }, "readOnly": true } } }, { "type": "object", "required": [ "method", "consumerName" ] } ] } } } }, "responses": { "201": { "description": "The newly created mandate object.", "content": { "application/hal+json": { "schema": { "allOf": [ { "type": "object", "properties": { "resource": { "type": "string", "description": "Indicates the response contains a mandate object. Will always contain the string `mandate` for this endpoint.", "readOnly": true, "default": "mandate" }, "id": { "allOf": [ { "type": "string", "pattern": "^mdt_.+$", "example": "mdt_5B8cwPMGnU" } ], "description": "The identifier uniquely referring to this mandate. Example: `mdt_pWUnw6pkBN`." }, "mode": { "type": "string", "description": "Whether this entity was created in live mode or in test mode.\n\nPossible values: `live` `test`", "readOnly": true, "example": "live" }, "method": { "type": "string", "description": "Payment method of the mandate.\n\nSEPA Direct Debit and PayPal mandates can be created directly.\n\nPossible values: `creditcard` `directdebit` `paypal`", "example": "directdebit" }, "consumerName": { "type": "string", "description": "The customer's name.", "example": "John Doe", "writeOnly": true }, "consumerAccount": { "type": [ "string", "null" ], "description": "The customer's IBAN. Required for SEPA Direct Debit mandates.", "example": "NL55INGB0000000000", "writeOnly": true }, "consumerBic": { "type": [ "string", "null" ], "description": "The BIC of the customer's bank.", "example": "BANKBIC", "writeOnly": true }, "consumerEmail": { "type": [ "string", "null" ], "description": "The customer's email address. Required for PayPal mandates.", "example": "example@email.com", "writeOnly": true }, "details": { "type": "object", "properties": { "consumerName": { "type": [ "string", "null" ], "description": "The customer's name. Available for SEPA Direct Debit and PayPal mandates.", "example": "John Doe" }, "consumerAccount": { "type": [ "string", "null" ], "description": "The customer's IBAN or email address. Available for SEPA Direct Debit and PayPal mandates.", "example": "NL55INGB0000000000" }, "consumerBic": { "type": [ "string", "null" ], "description": "The BIC of the customer's bank. Available for SEPA Direct Debit mandates.", "example": "BANKBIC" }, "cardHolder": { "type": [ "string", "null" ], "description": "The card holder's name. Available for card mandates.", "example": "John Doe" }, "cardNumber": { "type": [ "string", "null" ], "description": "The last four digits of the card number. Available for card mandates.", "example": 3240 }, "cardExpiryDate": { "type": [ "string", "null" ], "description": "The card's expiry date in `YYYY-MM-DD` format. Available for card mandates.", "example": "2025-01-01" }, "cardLabel": { "type": [ "string", "null" ], "description": "The card's label. Available for card mandates, if the card label could be detected.\n\nPossible values: `American Express` `Carta Si` `Carte Bleue` `Dankort` `Diners Club` `Discover` `JCB` `Laser` `Maestro` `Mastercard` `Unionpay` `Visa`", "example": "Visa" }, "cardFingerprint": { "type": [ "string", "null" ], "description": "Unique alphanumeric representation of this specific card. Available for card mandates. Can be used to identify returning customers.", "example": "d3290e932k02f" } }, "readOnly": true }, "signatureDate": { "type": [ "string", "null" ], "description": "The date when the mandate was signed in `YYYY-MM-DD` format.", "example": "2025-01-01" }, "mandateReference": { "type": [ "string", "null" ], "description": "A custom mandate reference. For SEPA Direct Debit, it is vital to provide a unique reference. Some banks will decline Direct Debit payments if the mandate reference is not unique.", "example": "ID-1023892" }, "paypalBillingAgreementId": { "type": [ "string", "null" ], "description": "The billing agreement ID given by PayPal. For example: `B-12A34567B8901234CD`. Required for PayPal mandates. Must provide either this field or `payPalVaultId`, but not both.", "example": "B-12A34567B8901234CD", "writeOnly": true }, "payPalVaultId": { "type": [ "string", "null" ], "description": "The Vault ID given by PayPal. For example: `8kk8451t`. Required for PayPal mandates. Must provide either this field or `paypalBillingAgreementId`, but not both.", "example": "8kk8451t", "writeOnly": true }, "status": { "allOf": [ { "type": "string", "description": "The status of the mandate. A status can be `pending` for mandates when the first payment is not yet finalized, or when we did not received the IBAN yet from the first payment.\n\nPossible values: `valid` `pending` `invalid`", "example": "valid" } ], "readOnly": true }, "customerId": { "allOf": [ { "type": "string", "pattern": "^cst_.+$", "example": "cst_5B8cwPMGnU" } ], "description": "The identifier referring to the [customer](get-customer) this mandate was linked to.", "readOnly": true }, "createdAt": { "type": "string", "description": "The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.", "readOnly": true, "example": "2024-03-20T09:13:37+00:00" }, "testmode": { "type": [ "boolean", "null" ], "description": "Whether to create the entity in test mode or live mode.\n\nMost API credentials are specifically created for either live mode or test mode, in which case this parameter must not be sent. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.", "writeOnly": true, "example": false }, "_links": { "type": "object", "description": "An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.", "required": [ "self", "customer", "documentation" ], "properties": { "self": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "customer": { "description": "The API resource URL of the [customer](get-customer) that this mandate belongs to.", "type": "object", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } }, "documentation": { "type": "object", "description": "In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "description": "The actual URL string.", "example": "https://..." }, "type": { "type": "string", "description": "The content type of the page or endpoint the URL points to.", "example": "application/hal+json" } } } }, "readOnly": true } } }, { "type": "object", "required": [ "resource", "id", "mode", "status", "method", "details", "customerId", "mandateReference", "signatureDate", "createdAt", "_links" ] } ] }, "examples": { "create-mandate-201-1": { "summary": "The mandate object", "value": { "resource": "mandate", "id": "mdt_h3gAaD5zP", "mode": "live", "status": "valid", "method": "directdebit", "details": { "consumerName": "John Doe", "consumerAccount": "NL55INGB0000000000", "consumerBic": "INGBNL2A" }, "mandateReference": "EXAMPLE-CORP-MD13804", "signatureDate": "2023-05-07", "customerId": "cst_4qqhO89gsT", "createdAt": "2023-05-07T10:49:08+00:00", "_links": { "self": { "href": "...", "type": "application/hal+json" }, "customer": { "href": "https://api.mollie.com/v2/customers/cst_4qqhO89gsT", "type": "application/hal+json" }, "documentation": { "href": "...", "type": "text/html" } } } }, "create-mandate-201-2": { "summary": "Create direct debit mandate for customer", "x-request": "./requests.yaml#/api-create-direct-debit-mandate-for-customer", "value": { "resource": "mandate", "id": "mdt_gDSN2rx3My", "mode": "test", "status": "valid", "method": "directdebit", "details": { "consumerName": "Jane Doe", "consumerAccount": "NL55INGB0000000000", "consumerBic": "INGBNL2A" }, "customerId": "cst_tKt44u85MM", "mandateReference": "YOUR-COMPANY-MD13804", "signatureDate": "2021-12-31", "createdAt": "2022-01-03T15:42:11+00:00", "_links": { "self": { "href": "...", "type": "application/hal+json" }, "customer": { "href": "https://api.mollie.com/v2/customers/cst_tKt44u85MM", "type": "application/hal+json" }, "documentation": { "href": "...", "type": "text/html" } } } } } } } }, "404": { "description": "No entity with this ID exists.", "content": { "application/hal+json": { "schema": { "type": "object", "description": "An error response object.", "required": [ "status", "title", "detail", "_links" ], "properties": { "status": { "type": "integer", "description": "The status code of the error message. This is always the same code as the status code of the HTTP message itself.", "minimum": 400, "maximum": 599, "example": 404 }, "title": { "type": "string", "description": "The HTTP reason phrase of the error. For example, for a `404` error, the `title` will be `Not Found`.", "example": "Not Found" }, "detail": { "type": "string", "description": "A detailed human-readable description of the error that occurred.", "example": "The resource does not exist" }, "field": { "type": "string", "description": "If the error was caused by a value provided by you in a specific field, the `field` property will contain the name of the field that caused the issue.", "example": "description" }, "_links": { "type": "object", "required": [ "documentation" ], "properties": { "documentation": { "type": "object", "description": "The URL to the generic Mollie API error handling guide.", "required": [ "href", "type" ], "properties": { "href": { "type": "string", "example": "https://docs.mollie.com/errors" }, "type": { "type": "string", "example": "text/html" } } } } } } }, "example": { "status": 404, "title": "Not Found", "detail": "No entity exists with token 'uct_abcDEFghij123456789'", "_links": { "documentation": { "href": "...", "type": "text/html" } } } } } } }, "x-readme": { "code-samples": [ { "language": "shell", "code": "curl -X POST https://api.mollie.com/v2/customers/cst_4qqhO89gsT/mandates \\\n -H \"Authorization: Bearer live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\" \\\n -d \"method=directdebit\" \\\n -d \"consumerName=John Doe\" \\\n -d \"consumerAccount=NL55INGB0000000000\" \\\n -d \"consumerBic=INGBNL2A\" \\\n -d \"signatureDate=2023-05-07\" \\\n -d \"mandateReference=EXAMPLE-CORP-MD13804\"" }, { "language": "php", "code": "setApiKey(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\");\n\n$mandate = $mollie->send(new CreateMandateRequest(\n customerId: \"cst_4qqhO89gsT\",\n method: MandateMethod::DIRECTDEBIT,\n consumerName: \"John Doe\",\n consumerAccount: \"NL55INGB0000000000\",\n consumerBic: \"INGBNL2A\",\n signatureDate: \"2023-05-07\",\n mandateReference: \"EXAMPLE-CORP-MD13804\"\n));", "install": "composer require mollie/mollie-api-php" }, { "language": "node", "code": "const { createMollieClient } = require('@mollie/api-client');\nconst mollieClient = createMollieClient({ apiKey: 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });\n\nconst mandate = await mollieClient.customerMandates.create({\n customerId: 'cst_4qqhO89gsT',\n method: 'directdebit',\n consumerName: 'John Doe',\n consumerAccount: 'NL55INGB0000000000',\n consumerBic: 'INGBNL2A',\n signatureDate: '2023-05-07',\n mandateReference: 'EXAMPLE-CORP-MD13804'\n});", "install": "npm install @mollie/api-client" }, { "language": "python", "code": "from mollie.api.client import Client\n\nmollie_client = Client()\nmollie_client.set_api_key(\"live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM\")\n\ncustomer = mollie_client.customers.get(\"cst_4qqhO89gsT\")\nmandate = customer.mandates.create({\n \"method\": \"directdebit\",\n \"consumerName\": \"John Doe\",\n \"consumerAccount\": \"NL55INGB0000000000\",\n \"consumerBic\": \"INGBNL2A\",\n \"signatureDate\": \"2023-05-07\",\n \"mandateReference\": \"EXAMPLE-CORP-MD13804\",\n})", "install": "pip install mollie-api-python" }, { "language": "ruby", "code": "require 'mollie-api-ruby'\n\nMollie::Client.configure do |config|\n config.api_key = 'live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM'\nend\n\nmandate = Mollie::Customer::Mandate.create(\n customer_id: 'cst_4qqhO89gsT',\n method: 'directdebit',\n consumer_name: 'John Doe',\n consumer_account: 'NL55INGB0000000000',\n consumer_bic: 'INGBNL2A',\n signature_date: '2023-05-07',\n mandate_reference: 'EXAMPLE-CORP-MD13804'\n)", "install": "gem install mollie-api-ruby" } ] } } } }, "components": { "securitySchemes": { "apiKey": { "type": "http", "scheme": "bearer", "x-default": "live_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "organizationAccessToken": { "type": "http", "scheme": "bearer", "x-default": "access_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" }, "oAuth": { "type": "oauth2", "flows": { "authorizationCode": { "authorizationUrl": "https://my.mollie.com/oauth2/authorize", "tokenUrl": "https://api.mollie.com/oauth2/tokens", "scopes": {} } } } } }, "x-readme": { "explorer-enabled": false, "samples-languages": [ "shell", "php", "node", "python", "ruby" ] } } ```