MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / getDefaultPaymentMethodId

Function getDefaultPaymentMethodId

app/src/server/utils/stripe.ts:51–64  ·  view source on GitHub ↗
(stripeCustomerId: string)

Source from the content-addressed store, hash-verified

49 stripe.paymentMethods.detach(paymentMethodId);
50
51export async function getDefaultPaymentMethodId(stripeCustomerId: string) {
52 const customer = await stripe.customers.retrieve(stripeCustomerId);
53
54 if (customer.deleted) {
55 return undefined;
56 }
57
58 const paymentMethodId = customer.invoice_settings.default_payment_method;
59 if (!paymentMethodId || typeof paymentMethodId !== "string") {
60 return undefined;
61 }
62
63 return paymentMethodId;
64}
65
66export const setDefaultPaymentMethod = async (stripeCustomerId: string, paymentMethodId: string) =>
67 stripe.customers.update(stripeCustomerId, {

Callers 2

payments.router.tsFile · 0.90
chargeInvoiceFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected