Skip to content

Scheduling infrastructure for absolutely everyone.

fix(payments): add return_url for Alipay PaymentIntent confirmation; fixes #19138 (#19153)

Shivansh Kumar1b111c8add3a
diff --git a/packages/features/ee/payments/components/Payment.tsx b/packages/features/ee/payments/components/Payment.tsx
index 4c7e849c192..cae28b4554b 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 1f589fb32e5..73c08111d75 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;