Edits history of script submission #22556 for ' Get recently added customers (stripe)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import {
      getState,
      setState,
    } from "windmill-client@1";
    import StripeClient from "[email protected]";
    
    type Stripe = {
      token: string;
    };
    export async function main(auth: Stripe) {
      const stripe = new StripeClient(auth.token, {
        httpClient: StripeClient.createFetchHttpClient(),
      });
      const lastCheck = (await getState()) || 0;
      await setState(Date.now());
      const customers = await stripe.customers.list({
        created: { gt: lastCheck },
      });
      return customers.data;
    }
    

    Submitted by hugo989 14 days ago