0

Get settlement payments

by
Published Apr 8, 2025

Retrieve all payments included in the given settlement. The response is in the same format as the response of the [List payments endpoint](list-payments). Refer to that endpoint's documentation for more details. For capture-based payment methods such as Klarna, the payments are not listed here. Refer to the [List captures endpoint](list-captures) endpoint instead. > 🔑 Access with > > Access token with **settlements.read** **payments.read**

Script mollie Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Mollie = {
3
  token: string;
4
};
5
/**
6
 * Get settlement payments
7
 * Retrieve all payments included in the given settlement.
8

9
The response is in the same format as the response of the [List payments endpoint](list-payments). Refer to that endpoint's documentation for more details.
10

11
For capture-based payment methods such as Klarna, the payments are not listed here. Refer to the [List captures endpoint](list-captures) endpoint instead.
12

13
> 🔑 Access with
14
>
15
> Access token with **settlements.read** **payments.read**
16
 */
17
export async function main(auth: Mollie, settlementId: string) {
18
  const url = new URL(
19
    `https://api.mollie.com/v2/settlements/${settlementId}/payments`,
20
  );
21

22
  const response = await fetch(url, {
23
    method: "GET",
24
    headers: {
25
      Authorization: "Bearer " + auth.token,
26
    },
27
    body: undefined,
28
  });
29
  if (!response.ok) {
30
    const text = await response.text();
31
    throw new Error(`${response.status} ${text}`);
32
  }
33
  return await response.text();
34
}
35