//native
type Mollie = {
token: string;
};
/**
* Get primary balance
* 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**
*/
export async function main(auth: Mollie) {
const url = new URL(`https://api.mollie.com/v2/balances/primary`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago