@cocalc/server
Version:
CoCalc server functionality: functions used by either the hub and the next.js server
16 lines (14 loc) • 420 B
text/typescript
import { StripeClient } from "@cocalc/server/stripe/client";
import { isValidUUID } from "@cocalc/util/misc";
export default async function getCustomer(
account_id: string
): Promise<object> {
if (!isValidUUID(account_id)) {
throw Error("invalid uuid");
}
const stripe = new StripeClient({ account_id });
if (!(await stripe.get_customer_id())) {
return {};
}
return await stripe.get_customer();
}