Search... Ctrl + K

Create Invoice Line Item (stripe)
One script reply has been approved by the moderators Verified

Created by rossmccrann 109 days ago Used 31 times 1 Point

Add a line item to an invoice. See the docs for more information

No comments yet

Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
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">,
  customer_id: string,
  price_id: string,
) {
  const token = stripe_con["token"];
  const stripe = Stripe(
    `${token}`,
    {
      httpClient: Stripe.createFetchHttpClient(),
    },
  );

  const invoiceItem = await stripe.invoiceItems.create({
    customer: `${customer_id}`,
    price: `${price_id}`,
  });

  return await invoiceItem.json();
}

Submitted by rossmccrann 109 days ago

Edited 109 days ago

No comments yet