Edits history of script submission #14297 for ' Three DS.Get Session By Id (basis_theory)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Basistheory = {
      apiKey: string;
    };
    /**
     * Three DS.Get Session By Id
     * Three DS.Get Session By Id
     */
    export async function main(auth: Basistheory, id: string) {
      const url = new URL(`https://api.basistheory.com/3ds/sessions/${id}`);
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          "BT-API-KEY": auth.apiKey,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago