Skip to content

Commit 3995e8a

Browse files
authored
fix(ui): Display non-validation Stripe errors within Checkout component (#9080)
1 parent caf5860 commit 3995e8a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.changeset/brave-mammals-burn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix the payment method form getting stuck in a loading state after a failed card setup. Non-validation errors such as 3DS authentication failures are now displayed.

packages/ui/src/components/PaymentMethods/AddPaymentMethod.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,14 @@ const AddPaymentMethodForm = ({ children }: PropsWithChildren) => {
206206

207207
const { data, error } = await submitPaymentElement();
208208
if (error) {
209-
return; // just return, since stripe will handle the error
209+
card.setIdle();
210+
// Validation errors are already rendered inline by Stripe's PaymentElement.
211+
// Non-validation errors (e.g. 3DS authentication failure) are not surfaced by
212+
// Stripe's UI, so we display them ourselves.
213+
if (error.error.type !== 'validation_error') {
214+
card.setError(error.error.message);
215+
}
216+
return;
210217
}
211218
try {
212219
await onSuccess(data);

0 commit comments

Comments
 (0)