Edits history of script submission #12639 for ' Submit onboarding data (mollie)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Mollie = {
      token: string;
    };
    /**
     * Submit onboarding data
     * **⚠️ We no longer recommend implementing this endpoint. Please refer to the Client Links API instead to kick off the onboarding process for your merchants.**
    
    Submit data that will be prefilled in the merchant's onboarding. The data you submit will only be processed when the onboarding status is `needs-data`. Information that the merchant has entered in their dashboard will not be
    
    overwritten.
    
    > 🔑 Access with
    >
    > Access token with **onboarding.write**
     */
    export async function main(
      auth: Mollie,
      body: {
        organization?: {
          name?: string;
          address?: {
            streetAndNumber?: string;
            postalCode?: string;
            city?: string;
            country?: string;
          };
          registrationNumber?: string;
          vatNumber?: string;
          vatRegulation?: string;
        };
        profile?: {
          name?: string;
          website?: string;
          email?: string;
          phone?: string;
          description?: string;
          businessCategory?: string;
        };
      },
    ) {
      const url = new URL(`https://api.mollie.com/v2/onboarding/me`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.token,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.text();
    }
    

    Submitted by hugo697 428 days ago