Edits history of script submission #12570 for ' Delete profile (mollie)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Mollie = {
      token: string;
    };
    /**
     * Delete profile
     * Delete a profile. A deleted profile and its related credentials can no longer be used for accepting payments.
    
    > 🔑 Access with
    >
    > Access token with **profiles.write**
     */
    export async function main(auth: Mollie, id: string) {
      const url = new URL(`https://api.mollie.com/v2/profiles/${id}`);
    
      const response = await fetch(url, {
        method: "DELETE",
        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