diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index f090f9e..3676615 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -692,7 +692,8 @@ export default function Navbar({
label: 'My Profile',
icon: ,
action: () => {
- navigate(citySelected ? `/${slugify(cityName)}/profile` : '/profile');
+ // navigate(citySelected ? `/${slugify(cityName)}/profile` : '/profile');
+ navigate(citySelected ? `/profile` : '/profile');
setActiveUserDropdown(false);
}
},
diff --git a/src/pages/PaymentCancelPage.tsx b/src/pages/PaymentCancelPage.tsx
index 108cf7b..8c37f8b 100644
--- a/src/pages/PaymentCancelPage.tsx
+++ b/src/pages/PaymentCancelPage.tsx
@@ -23,9 +23,10 @@ export function PaymentCancelPage({
}: PaymentCancelPageProps) {
const navigate = useNavigate();
- // ✅ Clear pending booking ID when user cancels
+ // ✅ Clear stored booking ID when user cancels
useEffect(() => {
localStorage.removeItem('pendingBookingId');
+ sessionStorage.removeItem('pendingBookingId');
}, []);
return (
@@ -64,12 +65,20 @@ export function PaymentCancelPage({
You cancelled the payment process. No charges have been made.
-
+
+
+
+
diff --git a/src/pages/PaymentSuccessPage.tsx b/src/pages/PaymentSuccessPage.tsx
index 83a2056..bf1967f 100644
--- a/src/pages/PaymentSuccessPage.tsx
+++ b/src/pages/PaymentSuccessPage.tsx
@@ -24,7 +24,6 @@ export function PaymentSuccessPage({
user,
}: PaymentSuccessPageProps) {
const [searchParams] = useSearchParams();
- const sessionId = searchParams.get('session_id');
const [confirmPayment, { isLoading }] = useConfirmCardPaymentMutation();
const [status, setStatus] = useState<'loading' | 'success' | 'error'>('loading');
const [errorMsg, setErrorMsg] = useState('');
@@ -32,55 +31,43 @@ export function PaymentSuccessPage({
useEffect(() => {
const confirm = async () => {
- // Try multiple sources for bookingId
+ // Try multiple sources to get bookingId
let bookingId = localStorage.getItem('pendingBookingId');
- if (!bookingId) {
- bookingId = sessionStorage.getItem('pendingBookingId');
- }
- // Optional: if you have bookingId in URL query param (e.g., ?bookingId=123)
- const urlBookingId = searchParams.get('bookingId');
- if (!bookingId && urlBookingId) {
- bookingId = urlBookingId;
- }
-
+ if (!bookingId) bookingId = sessionStorage.getItem('pendingBookingId');
+ if (!bookingId) bookingId = searchParams.get('bookingId'); // URL query param
+
console.log('Retrieved bookingId:', bookingId);
- console.log('SessionId from URL:', sessionId);
if (!bookingId) {
setStatus('error');
setErrorMsg(
- 'Missing booking information. Please contact support with your order reference. ' +
+ 'Booking ID not found. Please contact support with your order details. ' +
'If you just completed payment, your order may still be processing.'
);
return;
}
- if (!sessionId) {
- setStatus('error');
- setErrorMsg('Missing session ID. Please contact support.');
- return;
- }
-
try {
- await confirmPayment({ bookingId, sessionId }).unwrap();
+ // ✅ Call confirm API with only bookingId
+ await confirmPayment(bookingId).unwrap();
setStatus('success');
toast.success('Payment confirmed! Your order is complete.');
// Clean up storage
localStorage.removeItem('pendingBookingId');
sessionStorage.removeItem('pendingBookingId');
} catch (err: any) {
- console.error('Payment confirmation error:', err);
+ console.error('Confirmation error:', err);
setStatus('error');
- setErrorMsg(err?.data?.message || 'Payment could not be confirmed. Please contact support.');
- toast.error('Payment confirmation failed');
- // Clean up storage to avoid infinite loops
+ setErrorMsg(err?.data?.message || 'Failed to confirm payment. Please contact support.');
+ toast.error('Confirmation failed');
+ // Clean up to avoid retry loops
localStorage.removeItem('pendingBookingId');
sessionStorage.removeItem('pendingBookingId');
}
};
confirm();
- }, [sessionId, confirmPayment, searchParams]);
+ }, [confirmPayment, searchParams]);
return (