From 6e1a717ecf86e960b2bfa3fe7578d3a340ab3fae Mon Sep 17 00:00:00 2001 From: alannnc Date: Thu, 31 Aug 2023 12:15:45 -0700 Subject: [PATCH] fix: add metadata to stripe payment intent (#11053) --- packages/app-store/stripepayment/lib/PaymentService.ts | 9 ++++++++- packages/lib/payment/handlePayment.ts | 3 ++- packages/types/PaymentService.d.ts | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/app-store/stripepayment/lib/PaymentService.ts b/packages/app-store/stripepayment/lib/PaymentService.ts index 6211e77504..de021a7bcb 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, 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 3cbb6a224b..90155a56bd 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 26994b1bd3..43c4b29678 100644 --- a/packages/types/PaymentService.d.ts +++ b/packages/types/PaymentService.d.ts @@ -14,7 +14,8 @@ export interface IAbstractPaymentService { payment: Pick, bookingId: Booking["id"], bookerEmail: string, - paymentOption: PaymentOption + paymentOption: PaymentOption, + eventTitle?: string ): Promise; /* This method is to collect card details to charge at a later date ex. no-show fees */ collectCard(