0

Update profile

by
Published Apr 8, 2025

Update an existing profile. Profiles are required for payment processing. Normally they are created and updated via the Mollie dashboard. Alternatively, you can use this endpoint to automate profile management. > 🔑 Access with > > Access token with **profiles.write**

Script mollie Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Mollie = {
3
  token: string;
4
};
5
/**
6
 * Update profile
7
 * Update an existing profile.
8

9
Profiles are required for payment processing. Normally they are created and updated via the Mollie dashboard. Alternatively, you can use this endpoint to automate profile management.
10

11
> 🔑 Access with
12
>
13
> Access token with **profiles.write**
14
 */
15
export async function main(
16
  auth: Mollie,
17
  id: string,
18
  body: {
19
    name?: string;
20
    website?: string;
21
    email?: string;
22
    phone?: string;
23
    description?: string;
24
    countriesOfActivity?: string[];
25
    businessCategory?: string;
26
    mode?: string;
27
  },
28
) {
29
  const url = new URL(`https://api.mollie.com/v2/profiles/${id}`);
30

31
  const response = await fetch(url, {
32
    method: "PATCH",
33
    headers: {
34
      "Content-Type": "application/json",
35
      Authorization: "Bearer " + auth.token,
36
    },
37
    body: JSON.stringify(body),
38
  });
39
  if (!response.ok) {
40
    const text = await response.text();
41
    throw new Error(`${response.status} ${text}`);
42
  }
43
  return await response.text();
44
}
45