import * as wmill from "https://deno.land/x/windmill@v1.34.0/mod.ts";
import Stripe from "https://esm.sh/stripe?target=deno";

export async function main(
  stripe_con: wmill.Resource<"stripe">,
  charge_id: string,
) {
  const token = stripe_con["token"];
  const stripe = Stripe(
    `${token}`,
    {
      httpClient: Stripe.createFetchHttpClient(),
    },
  );

  const refund = await stripe.refunds.create({
    charge: `${charge_id}`,
  });

  return await refund.json();
}