0

Get settlement captures

by
Published Apr 8, 2025

Retrieve all captures included in the given settlement. The response is in the same format as the response of the [List captures endpoint](list-captures). Refer to that endpoint's documentation for more details. > 🔑 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 captures
7
 * Retrieve all captures included in the given settlement.
8

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

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

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