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

This commit is contained in:
alannnc
2023-08-31 19:15:45 +00:00
committed by GitHub
parent b2e098c781
commit 6e1a717ecf
3 changed files with 12 additions and 3 deletions
@@ -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, {
+2 -1
View File
@@ -59,7 +59,8 @@ const handlePayment = async (
},
booking.id,
bookerEmail,
paymentOption
paymentOption,
evt.title
);
}
+2 -1
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(