0

Disable payment method issuer

by
Published Apr 8, 2025

Disable an issuer for a payment method on a specific profile. Currently only the payment methods `voucher` and `giftcard` are supported. When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile. > 🔑 Access with > > API key > > Access token with **profiles.write**

Script mollie Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Mollie = {
3
  token: string;
4
};
5
/**
6
 * Disable payment method issuer
7
 * Disable an issuer for a payment method on a specific profile.
8

9
Currently only the payment methods `voucher` and `giftcard` are supported.
10

11
When using a profile-specific API credential, the alias `me` can be used instead of the profile ID to refer to the current profile.
12

13
> 🔑 Access with
14
>
15
> API key
16
>
17
> Access token with **profiles.write**
18
 */
19
export async function main(
20
  auth: Mollie,
21
  profileId: string,
22
  methodId: "voucher" | "giftcard",
23
  id: string,
24
) {
25
  const url = new URL(
26
    `https://api.mollie.com/v2/profiles/${profileId}/methods/${methodId}/issuers/${id}`,
27
  );
28

29
  const response = await fetch(url, {
30
    method: "DELETE",
31
    headers: {
32
      Authorization: "Bearer " + auth.token,
33
    },
34
    body: undefined,
35
  });
36
  if (!response.ok) {
37
    const text = await response.text();
38
    throw new Error(`${response.status} ${text}`);
39
  }
40
  return await response.text();
41
}
42