0

List all payment methods

by
Published Apr 8, 2025

Retrieve all payment methods that Mollie offers, regardless of the eligibility of the organization for the specific method. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API. The list can optionally be filtered using a number of parameters described below. > 🔑 Access with > > API key > > Access token with **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
 * List all payment methods
7
 * Retrieve all payment methods that Mollie offers, regardless of the eligibility of the organization for the specific method. The results of this endpoint are **not** paginated — unlike most other list endpoints in our API.
8

9
The list can optionally be filtered using a number of parameters described below.
10

11
> 🔑 Access with
12
>
13
> API key
14
>
15
> Access token with **payments.read**
16
 */
17
export async function main(
18
  auth: Mollie,
19
  locale: string | undefined,
20
  amount: string | undefined,
21
  include: "issuers" | "pricing" | undefined,
22
  sequenceType: string | undefined,
23
) {
24
  const url = new URL(`https://api.mollie.com/v2/methods/all`);
25
  for (const [k, v] of [
26
    ["locale", locale],
27
    ["amount", amount],
28
    ["include", include],
29
    ["sequenceType", sequenceType],
30
  ]) {
31
    if (v !== undefined && v !== "" && k !== undefined) {
32
      url.searchParams.append(k, v);
33
    }
34
  }
35
  const response = await fetch(url, {
36
    method: "GET",
37
    headers: {
38
      Authorization: "Bearer " + auth.token,
39
    },
40
    body: undefined,
41
  });
42
  if (!response.ok) {
43
    const text = await response.text();
44
    throw new Error(`${response.status} ${text}`);
45
  }
46
  return await response.text();
47
}
48