UI + UX Input And Data Entry standard

Payment card entry

Collect card details through secure hosted or processor-owned fields, format and validate card-specific parts, support paste, autofill, wallets, authentication and decline recovery, tokenize before review, and show only masked card details once captured.

Decision first

Choose this pattern when the problem matches

Use when

  • Users need to pay with a credit, debit, prepaid, or network card.
  • The product needs to add or update a card-on-file payment method.
  • The payment provider supports hosted fields, payment elements, tokenization, or wallet flows that fit the service.
  • Users need field-specific recovery before a charge, save, authentication step, or decline retry.

Avoid when

  • The task is to collect bank account identifiers for payout, ACH, direct debit, open banking, or bank transfer.
  • The product cannot protect cardholder data or integrate with a compliant processor-owned capture path.
  • A wallet, redirect, invoice, purchase order, bank debit, or saved payment method is the required payment route instead of manual card entry.
  • The service only needs a non-payment identifier, reference, or billing contact detail.
  • The organization cannot prevent raw PAN or CVC from entering logs, analytics, support tools, browser storage, or downstream systems.

Problem it prevents

Card payment details are high-risk, easy to mistype, brand-specific, and regulated, so ordinary text fields or unsafe review screens can cause failed payments, fraud exposure, and card-data leakage.

Pattern anatomy

What a strong implementation has to make clear

User need

The user is paying by card, adding a card for later use, replacing a card-on-file method, or confirming a card payment at checkout.

Pattern promise

Collect card details through secure hosted or processor-owned fields, format and validate card-specific parts, support paste, autofill, wallets, authentication and decline recovery, tokenize before review, and show only masked card details once captured.

Required state

Initial secure checkout state with amount, accepted card brands, wallet option, card number, expiry, CVC or CID, and billing postal code if required.

Recovery path

Full card details leak into application state, logs, analytics, replay tools, screenshots, or support transcripts.

Access contract

Use visible labels for card number, expiry, CVC or CID, cardholder name, and billing postal code; do not rely on placeholder examples alone.

Quality bar

The difference between expert and weak execution

Strong implementation

Specific, visible, recoverable

  • A checkout uses hosted fields for Card number, Expiry, CVC, and ZIP code; it detects Visa, accepts pasted spaces, validates expiry, tokenizes the card, and reviews Visa ending 4242 before charge.
  • A card-on-file setup offers a wallet button and manual card fields; after tokenization the saved payment method shows brand, last four digits, expiry, and billing ZIP, never the CVC.
  • A user pastes 4242 4242 4242 4242, sees Visa detected, enters 12/30 and 123, tokenizes the card, and reviews Visa ending 4242 before paying.
  • A user enters an American Express card and the form expects a four-digit CID while keeping the card number grouping and last-four review accurate.
Weak implementation

Vague, hidden, hard to recover from

  • A page asks users to paste card number, expiry, CVC, and billing address into one notes field.
  • A review page shows the full card number and CVC so the user can check them before payment.
  • A user enters an expired card and receives only Payment failed after submit with no field-level route back to expiry.
  • A user cannot pay because the wallet button is the only available path and their browser does not support that wallet.
UI guidance
  • Render card entry as a secure grouped checkout surface with processor-hosted or payment-element fields for card number, expiry, CVC or CID, billing postal code when required, clear labels, card brand feedback, field errors, wallet options, and a masked review summary.
  • Use card-specific autocomplete tokens, input modes, readable grouping, brand marks, and stable helper text without making placeholders the only instruction or showing raw card details after tokenization.
UX guidance
  • Use payment card entry when a user needs to pay with a card or add a card-on-file payment method and the product can protect cardholder data through a payment processor or compliant card-data environment.
  • Help users complete the payment by tolerating paste and autofill, detecting supported brands, explaining field and processor errors, offering wallet or authentication recovery paths, and showing only masked card details before charging.
Implementation contract

What the implementation must handle

States

  • Initial secure checkout state with amount, accepted card brands, wallet option, card number, expiry, CVC or CID, and billing postal code if required.
  • Focused entry state with persistent labels, autocomplete purpose, and helper text that survives placeholder disappearance.
  • Pasted card number state where spaces and hyphens are accepted and grouped for review.
  • Brand detected state showing supported brand and expected CVC or CID length.

Interaction

  • Users can type, paste, autofill, delete, select, and correct card number, expiry, CVC, and postal code fields without losing entered values.
  • Card number grouping helps readability but the canonical value is the digit sequence passed to the processor-hosted field or tokenization call.
  • Brand feedback updates as enough digits are entered and changes CVC or CID expectations only when the brand is known.
  • Submitting incomplete or invalid details keeps the entered safe-to-display values visible and focuses the first actionable error.

Accessibility

  • Use visible labels for card number, expiry, CVC or CID, cardholder name, and billing postal code; do not rely on placeholder examples alone.
  • Expose input purpose with autocomplete tokens and keep helper text connected to inputs or hosted-field containers.
  • Ensure hosted iframes or embedded payment components have focus indicators, names, errors, and screen reader behavior equivalent to native fields.
  • Announce brand detection and validation outcomes without interrupting every digit entry.

Review

  • Which processor or hosted component owns PAN and CVC collection?
  • Which card brands, number lengths, CVC lengths, billing data, wallets, and authentication paths are supported?
  • Can users paste or autofill card details without breaking grouping, validation, or browser security controls?
  • How does the UI distinguish invalid fields, unsupported brand, expired card, requires authentication, declined, processing, tokenized, and succeeded states?
Interactive lab

Inspect the states before you copy the pattern

Capture and tokenize card details

Paste a card number, inspect brand detection, trigger Luhn, expiry, CVC, and postal-code errors, tokenize the card, try the wallet path, and review only masked card details before charge.

Payment card entry
Interactive demo is ready

Launch the live UI/UX lab when you want to inspect states, keyboard behavior, and common failure modes.

State To Inspect

Initial secure checkout state with amount, accepted card brands, wallet option, card number, expiry, CVC or CID, and billing postal code if required.

Keyboard / Access

Tab order follows wallet option if present, card number, expiry, CVC or CID, billing postal code, optional cardholder name, review, and charge action.

Avoid Generating

Using one multiline field for card number, expiry, CVC, and billing details.

Evidence trail

Source-backed claims behind this guidance

Adyen Card Component for web

Adyen - checked

Adyen supports card brand recognition, holder name, billing postal code, CVC display control, expiry rules, accessible error configuration, and field-level events.

Braintree Hosted Fields overview

PayPal Braintree - checked

Braintree supports hosted card number, CVV, expiration date, and postal code fields for custom-styled checkout pages.

Full agent/debug reference

Problem Context

  • The user is paying by card, adding a card for later use, replacing a card-on-file method, or confirming a card payment at checkout.
  • The form may need card number, cardholder name, expiry month and year, CVC or CID, billing ZIP or postal code, billing country, wallet selection, supported brand detection, and authentication outcomes.
  • Users copy from physical cards, wallet apps, password managers, browser autofill, or bank apps and may paste spaces, hyphens, or cardholder names in different case.
  • Card brands and payment processors can impose different number lengths, CVC lengths, supported brands, billing address needs, authentication requirements, and decline responses.
  • Cardholder data and sensitive authentication data require careful scope control, redaction, logging discipline, and clear retention limits.

Selection Rules

  • Choose payment card entry when the task is to charge a card, verify a card, save a card payment method, or replace a card-on-file credential.
  • Use hosted fields, payment elements, or processor-controlled components for PAN and CVC whenever the product does not intentionally own full card-data processing.
  • Ask for card number, expiry, and CVC or CID only when needed by the payment flow, and ask for cardholder name or billing postal code when processor, fraud, AVS, tax, or receipt requirements need them.
  • Support browser autofill with cc-name, cc-number, cc-exp or month and year tokens, cc-csc, cc-type when exposed, postal-code, transaction-currency, and transaction-amount as appropriate.
  • Accept pasted card numbers with spaces or hyphens, then group them for readability without changing the canonical digits.
  • Detect card brand and supported brand state from the entered number, but do not use a brand icon as the only validation feedback.
  • Validate Luhn or processor-equivalent card number rules, supported length, expiry not in the past, CVC or CID length, and billing postal code before charging.
  • Handle unsupported brand, invalid field, requires authentication, declined, processing, tokenized, saved, and succeeded states as distinct user-facing outcomes.
  • Offer wallet, Link-style, or payment-request options where available, while keeping manual card entry or another accessible fallback.
  • After tokenization or authorization, show only brand, last four digits, expiry when safe, billing postal code, and payment method status on review and receipts.
  • Do not store, log, echo, email, chat, screenshot, or analytics-track full card numbers or CVC values.
  • Do not treat a card-number mask, expiry date field, or review page as a substitute for secure card capture.

Required States

  • Initial secure checkout state with amount, accepted card brands, wallet option, card number, expiry, CVC or CID, and billing postal code if required.
  • Focused entry state with persistent labels, autocomplete purpose, and helper text that survives placeholder disappearance.
  • Pasted card number state where spaces and hyphens are accepted and grouped for review.
  • Brand detected state showing supported brand and expected CVC or CID length.
  • Unsupported brand state with a clear alternate payment path.
  • Invalid card number state with checksum or length correction guidance.
  • Expired or impossible expiry state using month and year guidance rather than a full date picker.
  • CVC or CID error state that respects three- and four-digit brand differences.
  • Billing postal code required or invalid state where processor or country rules require it.
  • Tokenized state where raw PAN and CVC are no longer displayed or retained by the app.
  • Wallet selected state with network-token or processor-token summary and manual fallback still available.
  • Requires authentication, declined, processing, succeeded, and retry states after payment submission.
  • Masked review state with brand, last four digits, expiry, amount, billing context, and explicit charge action.

Interaction Contract

  • Users can type, paste, autofill, delete, select, and correct card number, expiry, CVC, and postal code fields without losing entered values.
  • Card number grouping helps readability but the canonical value is the digit sequence passed to the processor-hosted field or tokenization call.
  • Brand feedback updates as enough digits are entered and changes CVC or CID expectations only when the brand is known.
  • Submitting incomplete or invalid details keeps the entered safe-to-display values visible and focuses the first actionable error.
  • Processor and wallet states are represented explicitly instead of hidden behind one catch-all payment error.
  • Tokenized and saved-card states never redisplay the full PAN or CVC, and later screens cannot recover CVC from the UI.
  • A final charge action uses masked card details and amount so users can detect the wrong card before payment.

Implementation Checklist

  • Select the payment processor, hosted-field or payment-element integration, supported brands, card-on-file rules, wallet support, authentication requirements, billing data, and PCI scope before designing the checkout.
  • Use native labels, autocomplete tokens, inputmode values, aria-describedby hints, field-specific errors, and processor-provided accessible states for hosted iframes or embedded elements.
  • Normalize paste and display grouping while preserving leading digits and never copying raw PAN or CVC into app-managed state beyond what the processor component requires.
  • Implement brand detection, supported-brand decisions, expiry validation, CVC or CID length checks, postal-code requirements, and processor decline or authentication recovery as separate states.
  • Redact card details from logs, analytics, replay tools, support transcripts, screenshots, error payloads, local storage, and review pages.
  • Show masked review details and amount before charge, and keep receipts or saved methods limited to brand, last four digits, expiry, and billing details that are safe to display.
  • Test paste, autofill, mobile keyboards, saved cards, wallets, unsupported brands, American Express CID, variable-length card numbers, expired card, declined card, required authentication, network failure, retry, browser Back, zoom, screen readers, and high contrast.

Common Generated-UI Mistakes

  • Using one multiline field for card number, expiry, CVC, and billing details.
  • Collecting card details through ordinary app-owned inputs when hosted fields or a payment element are required by the intended compliance model.
  • Assuming every card number has sixteen digits or every security code has three digits.
  • Displaying or storing CVC after authorization.
  • Showing a full card number on review, receipt, admin screens, or support tools.
  • Blocking paste, autofill, or password-manager card filling.
  • Using a wallet button as the only payment path.
  • Reporting every card-entry, authentication, decline, or network issue as Payment failed.
  • Saving card details before the user has seen a masked review and explicit save or charge action.

Critique Questions

  • Which processor or hosted component owns PAN and CVC collection?
  • Which card brands, number lengths, CVC lengths, billing data, wallets, and authentication paths are supported?
  • Can users paste or autofill card details without breaking grouping, validation, or browser security controls?
  • How does the UI distinguish invalid fields, unsupported brand, expired card, requires authentication, declined, processing, tokenized, and succeeded states?
  • Where could raw PAN or CVC appear in logs, analytics, screenshots, support tools, browser storage, or review pages?
  • What exact masked details are shown before charge so users can recognize the card without exposing sensitive data?
Accessibility
  • Use visible labels for card number, expiry, CVC or CID, cardholder name, and billing postal code; do not rely on placeholder examples alone.
  • Expose input purpose with autocomplete tokens and keep helper text connected to inputs or hosted-field containers.
  • Ensure hosted iframes or embedded payment components have focus indicators, names, errors, and screen reader behavior equivalent to native fields.
  • Announce brand detection and validation outcomes without interrupting every digit entry.
  • Provide text labels for brand, unsupported card, tokenized, wallet, authentication, declined, and processing states rather than relying only on icons or color.
  • Move focus to the first field error or error summary on submit while preserving entered values.
  • Keep wallet buttons, manual card entry, authentication retry, and alternate payment paths reachable by keyboard.
Keyboard Behavior
  • Tab order follows wallet option if present, card number, expiry, CVC or CID, billing postal code, optional cardholder name, review, and charge action.
  • Typing, deletion, selection, paste, undo, and redo remain as close to native field behavior as the hosted component allows.
  • Separators in card number or expiry display do not become separate focus targets.
  • Submit with invalid details moves focus to the first actionable error and does not clear safe-to-display values.
  • Authentication, wallet confirmation, retry, change card, and cancel paths are keyboard reachable.
  • Browser Back and saved checkout sessions restore tokenized or editable states according to security policy without redisplaying CVC.
Variants
  • Single-line card element
  • Split hosted card fields
  • Cardholder name field
  • Billing ZIP or postal-code field
  • Brand-detected card number
  • American Express CID handling
  • Variable-length card number
  • Wallet or payment request fallback
  • Card-on-file setup
  • Saved card replacement
  • Requires authentication recovery
  • Masked card review

Verification

Last verified: