Skip to content

Commit 7bfb1ca

Browse files
panteliselefwobsoriano
authored andcommitted
fix(clerk-js): Avoid using needsPaymentMethod in CheckoutComplete step (#7140)
1 parent 7077745 commit 7bfb1ca

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Bug fix for Checkout success screen to not mention payment if a payment was not made.

packages/clerk-js/src/ui/components/Checkout/CheckoutComplete.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export const CheckoutComplete = () => {
161161
const { setIsOpen } = useDrawerContext();
162162
const { newSubscriptionRedirectUrl } = useCheckoutContext();
163163
const { checkout } = useCheckout();
164-
const { totals, paymentMethod, planPeriodStart, freeTrialEndsAt, needsPaymentMethod } = checkout;
164+
const { totals, paymentMethod, planPeriodStart, freeTrialEndsAt } = checkout;
165165
const [mousePosition, setMousePosition] = useState({ x: 256, y: 256 });
166166

167167
const prefersReducedMotion = usePrefersReducedMotion();
@@ -331,7 +331,7 @@ export const CheckoutComplete = () => {
331331
localizationKey={
332332
freeTrialEndsAt
333333
? localizationKeys('billing.checkout.title__trialSuccess')
334-
: needsPaymentMethod
334+
: totals.totalDueNow.amount > 0
335335
? localizationKeys('billing.checkout.title__paymentSuccessful')
336336
: localizationKeys('billing.checkout.title__subscriptionSuccessful')
337337
}
@@ -386,7 +386,7 @@ export const CheckoutComplete = () => {
386386
}),
387387
})}
388388
localizationKey={
389-
needsPaymentMethod
389+
totals.totalDueNow.amount > 0
390390
? localizationKeys('billing.checkout.description__paymentSuccessful')
391391
: localizationKeys('billing.checkout.description__subscriptionSuccessful')
392392
}
@@ -430,14 +430,14 @@ export const CheckoutComplete = () => {
430430
<LineItems.Group variant='secondary'>
431431
<LineItems.Title
432432
title={
433-
needsPaymentMethod
433+
totals.totalDueNow.amount > 0 || freeTrialEndsAt !== null
434434
? localizationKeys('billing.checkout.lineItems.title__paymentMethod')
435435
: localizationKeys('billing.checkout.lineItems.title__subscriptionBegins')
436436
}
437437
/>
438438
<LineItems.Description
439439
text={
440-
needsPaymentMethod
440+
totals.totalDueNow.amount > 0 || freeTrialEndsAt !== null
441441
? paymentMethod
442442
? paymentMethod.paymentType !== 'card'
443443
? `${capitalize(paymentMethod.paymentType)}`

0 commit comments

Comments
 (0)