Skip to content

Scheduling infrastructure for absolutely everyone.

fix: add metadata to stripe payment intent (#11053)

alannnc6e1a717ecf86
diff --git a/packages/app-store/stripepayment/lib/PaymentService.ts b/packages/app-store/stripepayment/lib/PaymentService.ts
index 6211e775044..de021a7bcb5 100644
--- a/packages/app-store/stripepayment/lib/PaymentService.ts
+++ b/packages/app-store/stripepayment/lib/PaymentService.ts
@@ -50,7 +50,8 @@ export class PaymentService implements IAbstractPaymentService {
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
bookingId: Booking["id"],
bookerEmail: string,
- paymentOption: PaymentOption
+ paymentOption: PaymentOption,
+ eventTitle?: string
) {
try {
// Ensure that the payment service can support the passed payment option
@@ -78,6 +79,12 @@ export class PaymentService implements IAbstractPaymentService {
currency: this.credentials.default_currency,
payment_method_types: ["card"],
customer: customer.id,
+ metadata: {
+ identifier: "cal.com",
+ bookingId,
+ bookerEmail,
+ eventName: eventTitle || "",
+ },
};
const paymentIntent = await this.stripe.paymentIntents.create(params, {
diff --git a/packages/lib/payment/handlePayment.ts b/packages/lib/payment/handlePayment.ts
index 3cbb6a224bf..90155a56bd9 100644
--- a/packages/lib/payment/handlePayment.ts
+++ b/packages/lib/payment/handlePayment.ts
@@ -59,7 +59,8 @@ const handlePayment = async (
},
booking.id,
bookerEmail,
- paymentOption
+ paymentOption,
+ evt.title
);
}
diff --git a/packages/types/PaymentService.d.ts b/packages/types/PaymentService.d.ts
index 26994b1bd3f..43c4b296786 100644
--- a/packages/types/PaymentService.d.ts
+++ b/packages/types/PaymentService.d.ts
@@ -14,7 +14,8 @@ export interface IAbstractPaymentService {
payment: Pick<Prisma.PaymentUncheckedCreateInput, "amount" | "currency">,
bookingId: Booking["id"],
bookerEmail: string,
- paymentOption: PaymentOption
+ paymentOption: PaymentOption,
+ eventTitle?: string
): Promise<Payment>;
/* This method is to collect card details to charge at a later date ex. no-show fees */
collectCard(