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

pull/10996/head
alannnc 2023-08-31 12:15:45 -07:00 committed by GitHub
parent b2e098c781
commit 6e1a717ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -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, {

View File

@ -59,7 +59,8 @@ const handlePayment = async (
},
booking.id,
bookerEmail,
paymentOption
paymentOption,
evt.title
);
}

View File

@ -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(