Skip to content

Commit 04ed701

Browse files
committed
feat(payments-next): Redirect user to Subscription Management on payment update
Because: * Stripe's PaymentElement has several UX issues around how Link cards are displayed. These are not controllable by us, and as a workaround we will redirect users to the base Subscription Management page when they successfully change their default payment method. This commit: * Updates the redirect/validation logic that occurs when the user submits their updated payment method Closes #PAY-3536
1 parent 8014bb0 commit 04ed701

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

  • apps/payments/next/app/[locale]/subscriptions/payments/stripe
  • libs/payments/ui/src/lib/client/components/PaymentMethodManagement

apps/payments/next/app/[locale]/subscriptions/payments/stripe/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export default async function StripePaymentManagementPage({
6161
uid={session?.user?.id}
6262
defaultPaymentMethod={defaultPaymentMethod}
6363
sessionEmail={session?.user?.email ?? undefined}
64+
locale={locale}
6465
/>
6566
</StripeManagementWrapper>
6667
</section>

libs/payments/ui/src/lib/client/components/PaymentMethodManagement/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ export function PaymentMethodManagement({
3030
uid,
3131
defaultPaymentMethod,
3232
sessionEmail,
33+
locale,
3334
}: {
3435
uid?: string;
3536
defaultPaymentMethod?: {
3637
id: string;
3738
type?: string;
3839
};
3940
sessionEmail?: string;
41+
locale: string;
4042
}) {
4143
const { l10n } = useLocalization();
4244
const stripe = useStripe();
@@ -194,7 +196,7 @@ export function PaymentMethodManagement({
194196
if (result.status === 'requires_action' && result.clientSecret) {
195197
await handleNextAction(result.clientSecret);
196198
}
197-
router.refresh();
199+
router.push(`/${locale}/subscriptions/manage`);
198200
}
199201
} catch (error) {
200202
console.error(error);

0 commit comments

Comments
 (0)