Edits history of script submission #22548 for ' Create a Refund (stripe)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import StripeClient from "stripe@11";
    
    type Stripe = {
      token: string;
    };
    export async function main(stripe_con: Stripe, charge_id: string) {
      const token = stripe_con["token"];
      const stripe = StripeClient(`${token}`, {
        httpClient: StripeClient.createFetchHttpClient(),
      });
    
      const refund = await stripe.refunds.create({
        charge: `${charge_id}`,
      });
    
      return await refund.json();
    }
    

    Submitted by hugo989 2 days ago