Update customer

Customers API v2
PATCHhttps://api.mollie.com/v2/customers/*id*

Update an existing customer.

Parameters

Replace id in the endpoint URL by the customer’s ID, for example cst_8wmqcHMN4U.

namestringoptional
The full name of the customer.
emailstringoptional
The email address of the customer.
localestringoptional

Allows you to preset the language to be used in the hosted payment pages shown to the consumer. When this parameter is not provided, the browser language will be used instead in the payment flow (which is usually more accurate).

Possible values: en_US en_GB nl_NL nl_BE fr_FR fr_BE de_DE de_AT de_CH es_ES ca_ES pt_PT it_IT nb_NO sv_SE fi_FI da_DK is_IS hu_HU pl_PL lv_LV lt_LT

metadatamixedoptional
Provide any data you like, and we will save the data alongside the customer. Whenever you fetch the customer with our API, we will also include the metadata. You can use up to 1kB of JSON.

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

200 application/hal+json

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

Example

cURLPHPPythonRubyNode.js
1
2
3
4
curl -X PATCH https://api.mollie.com/v2/customers/cst_8wmqcHMN4U \
   -H "Authorization: Bearer test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM" \
   -d "name=Updated Customer A" \
   -d "email=updated-customer@example.org"
1
2
3
4
5
6
7
8
9
<?php
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");

$customerId = "cst_8wmqcHMN4U";
$customer = $mollie->customers->update($customerId, [
  "name" => "Updated Customer A",
  "email" => "updated-customer@example.org",
]);
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from mollie.api.client import Client

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

customer = mollie_client.customers.update(
    "cst_8wmqcHMN4U",
    {
        "name": "Updated Customer A",
        "email": "updated-customer@example.org"
    },
)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
require 'mollie-api-ruby'

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

customer = Mollie::Customer.update(
  'cst_8wmqcHMN4U',
  name: 'Updated Customer A',
  email: 'updated-customer@example.org'
)
1
2
3
4
5
6
7
const { createMollieClient } = require('@mollie/api-client');
const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });

const customer = await mollieClient.customers.update('cst_8wmqcHMN4U', {
  name: 'Updated Customer A',
  email: 'updated-customer@example.org'
});

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
HTTP/1.1 200 OK
Content-Type: application/hal+json

{
    "resource": "customer",
    "id": "cst_8wmqcHMN4U",
    "mode": "test",
    "name": "Updated Customer A",
    "email": "updated-customer@example.org",
    "locale": "nl_NL",
    "metadata": null,
    "createdAt": "2018-04-06T13:23:21.0Z",
    "_links": {
        "self": {
            "href": "https://api.mollie.com/v2/customers/cst_8wmqcHMN4U",
            "type": "application/hal+json"
        },
        "dashboard": {
            "href": "https://www.mollie.com/dashboard/org_123456789/customers/cst_8wmqcHMN4U",
            "type": "text/html"
        },
        "documentation": {
            "href": "https://docs.mollie.com/reference/v2/customers-api/get-customer",
            "type": "text/html"
        }
    }
}