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>
This commit is contained in:
Shivansh Kumar
2025-03-05 11:57:43 -03:00
committed by GitHub
co-authored by Anik Dhabal Babu
parent be1377e9af
commit 1b111c8add
2 changed files with 8 additions and 0 deletions
@@ -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) {
@@ -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;