Search... Ctrl + K

Update a Customer (stripe)
One script reply has been approved by the moderators Verified

Created by rossmccrann 107 days ago Used 44 times 1 Point

Update a customer. 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,
  order_id: string,
) {
  const token = stripe_con["token"];
  const stripe = Stripe(
    `${token}`,
    {
      httpClient: Stripe.createFetchHttpClient(),
    },
  );

  const customer = await stripe.customers.update(
    `${customer_id}`,
    { metadata: { order_id: order_id } },
  );

  return await customer.json();
}

Submitted by rossmccrann 107 days ago

Edited 107 days ago

No comments yet