basics · 2025-04-28 · 5 min read
Designing card-form error messages that actually help
'Invalid card' is useless. Tell the user what to check, time the message well, and never blame the card for a typo you can see — small wording changes measurably lift checkout completion.

When the Luhn check fails, the most likely cause is a single mistyped digit. Say so: 'This number looks mistyped — please check it.' Avoid wording that implies the card is declined or blocked; the issuer has not even been asked yet. Our inspection bench phrases every failure as something the user can act on.
Timing
- Validate on blur (leaving the field) or once the expected length is reached — not on every keystroke, which shouts at people mid-typing.
- Re-validate on input only after an error has been shown, so the message clears the moment the fix is typed.
- Never clear the field on error.
Content
- Name the field and the fix in one sentence: 'Expiry date is in the past — check the year.'
- Show the detected brand logo early; it reassures users they are on the right track and catches 'I typed my debit card' confusion.
- Distinguish format problems (fixable here) from authorization problems (fixable by the bank) with different visuals.
Placement and accessibility
Put the message directly under the field, keep focus on the failing input, link it with aria-describedby, and use aria-live="polite" so screen readers announce it. Colour alone is not enough — add an icon or text. Baymard's card form research and the Nielsen Norman Group's error-message guidelines quantify the impact.
Good messages pair with good input ergonomics; see formatting as you type and expiry date rules.

Keywords: checkout UX, form validation messages, card form errors, inline validation, conversion rate, payment form design, accessible error messages
Frequently asked questions
When should a card number field show an error?
On blur or once the number reaches its expected length — not on every keystroke while the user is still typing.
What should the error say when Luhn fails?
That the number looks mistyped and should be re-checked — not that the card is invalid or declined.