Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/petite-sites-see.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Fix Stripe Elements error handling
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,18 @@ const AddPaymentSourceForm = ({ children }: PropsWithChildren) => {
card.setLoading();
card.setError(undefined);

try {
const { setupIntent, error } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: '', // TODO(@COMMERCE): need to figure this out
},
redirect: 'if_required',
});
if (error) {
return; // just return, since stripe will handle the error
}
const { setupIntent, error } = await stripe.confirmSetup({
elements,
confirmParams: {
return_url: '', // TODO(@COMMERCE): need to figure this out
},
redirect: 'if_required',
});
if (error) {
return; // just return, since stripe will handle the error
}

try {
await onSuccess({ stripeSetupIntent: setupIntent });
} catch (error) {
void handleError(error, [], card.setError);
Expand Down
Loading