Edits history of script submission #14235 for ' Apple Pay Session (basis_theory)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Basistheory = {
      apiKey: string;
    };
    /**
     * Apple Pay Session
     * Apple Pay Session
     */
    export async function main(
      auth: Basistheory,
      body: { display_name?: string; domain?: string; validation_url?: string },
    ) {
      const url = new URL(
        `https://api.basistheory.com/connections/apple-pay/session`,
      );
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "BT-API-KEY": auth.apiKey,
        },
        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 235 days ago