MCPcopy
hub / github.com/OpenPipe/OpenPipe / createStripePaymentIntent

Function createStripePaymentIntent

app/src/server/utils/stripe.ts:9–35  ·  view source on GitHub ↗
({
  amount,
  stripeCustomerId,
  paymentMethodId,
  returnUrl,
  invoiceId,
}: {
  amount: number;
  stripeCustomerId: string;
  paymentMethodId: string;
  returnUrl: string;
  invoiceId: string;
})

Source from the content-addressed store, hash-verified

7const stripe = new Stripe(env.STRIPE_SECRET_KEY ?? "");
8
9export async function createStripePaymentIntent({
10 amount,
11 stripeCustomerId,
12 paymentMethodId,
13 returnUrl,
14 invoiceId,
15}: {
16 amount: number;
17 stripeCustomerId: string;
18 paymentMethodId: string;
19 returnUrl: string;
20 invoiceId: string;
21}) {
22 return stripe.paymentIntents.create({
23 amount,
24 currency: "usd",
25 automatic_payment_methods: { enabled: true },
26 customer: stripeCustomerId,
27 payment_method: paymentMethodId,
28 return_url: returnUrl,
29 off_session: true,
30 confirm: true,
31 metadata: {
32 invoiceId, // Used to track status using webhooks
33 },
34 });
35}
36export const createSetupIntent = async (stripeCustomerId: string) =>
37 stripe.setupIntents.create({
38 customer: stripeCustomerId,

Callers 1

chargeInvoiceFunction · 0.90

Calls 1

createMethod · 0.45

Tested by

no test coverage detected