//native
type Mollie = {
token: string;
};
/**
* Get settlement payments
* 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**
*/
export async function main(auth: Mollie, settlementId: string) {
const url = new URL(
`https://api.mollie.com/v2/settlements/${settlementId}/payments`,
);
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