From 1b111c8add3afec42787335cff896eafea16c6bb Mon Sep 17 00:00:00 2001 From: Shivansh Kumar <104713531+ShivanshKumar760@users.noreply.github.com> Date: Wed, 5 Mar 2025 20:27:43 +0530 Subject: [PATCH] fix(payments): add return_url for Alipay PaymentIntent confirmation; fixes #19138 (#19153) * Update README.md * fix(payments): add return_url for Alipay PaymentIntent confirmation; fixes #19138 * Fix: update confirmPayment to use confirmParams and resolve TS errors * Update Payment.tsx * Update * fix build error --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> --- packages/features/ee/payments/components/Payment.tsx | 4 ++++ .../platform/atoms/event-types/payments/StripePaymentForm.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/features/ee/payments/components/Payment.tsx b/packages/features/ee/payments/components/Payment.tsx index 4c7e849c19..cae28b4554 100644 --- a/packages/features/ee/payments/components/Payment.tsx +++ b/packages/features/ee/payments/components/Payment.tsx @@ -7,6 +7,7 @@ import { useEffect, useState } from "react"; import getStripe from "@calcom/app-store/stripepayment/lib/client"; import { useBookingSuccessRedirect } from "@calcom/lib/bookingSuccessRedirect"; +import { WEBAPP_URL } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { PaymentOption } from "@calcom/prisma/enums"; @@ -177,6 +178,9 @@ const PaymentForm = (props: Props) => { } else if (paymentOption === "ON_BOOKING") { payload = await stripe.confirmPayment({ elements, + confirmParams: { + return_url: `${WEBAPP_URL}/booking/${params.uid}`, + }, redirect: "if_required", }); if (payload.paymentIntent) { diff --git a/packages/platform/atoms/event-types/payments/StripePaymentForm.tsx b/packages/platform/atoms/event-types/payments/StripePaymentForm.tsx index 1f589fb32e..73c08111d7 100644 --- a/packages/platform/atoms/event-types/payments/StripePaymentForm.tsx +++ b/packages/platform/atoms/event-types/payments/StripePaymentForm.tsx @@ -6,6 +6,7 @@ import getStripe from "@calcom/app-store/stripepayment/lib/client"; import type { Props, States } from "@calcom/features/ee/payments/components/Payment"; import { PaymentFormComponent } from "@calcom/features/ee/payments/components/Payment"; import type { PaymentPageProps } from "@calcom/features/ee/payments/pages/payment"; +import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; const StripePaymentComponent = ( @@ -63,6 +64,9 @@ const StripePaymentComponent = ( payload = await stripe.confirmPayment({ elements, redirect: "if_required", + confirmParams: { + return_url: `${WEBAPP_URL}/booking/${params.uid}`, + }, }); if (payload.paymentIntent) { params.payment_intent = payload.paymentIntent.id;