0

Get primary balance

by
Published Apr 8, 2025

Retrieve the primary balance. This is the balance of your account's primary currency, where all payments are settled to by default. This endpoint is a convenient alias of the [Get balance](get-balance) endpoint. For a complete reference of the balance object, refer to that endpoint's documentation. > 🔑 Access with > > Access token with **balances.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 primary balance
7
 * Retrieve the primary balance. This is the balance of your account's primary currency, where all payments are settled to by default.
8

9
This endpoint is a convenient alias of the [Get balance](get-balance) endpoint. For a complete reference of the balance object, refer to that endpoint's documentation.
10

11
> 🔑 Access with
12
>
13
> Access token with **balances.read**
14
 */
15
export async function main(auth: Mollie) {
16
  const url = new URL(`https://api.mollie.com/v2/balances/primary`);
17

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