Skip to main content
Every element surfaces validation errors on two channels: onChange.errors while the shopper is typing, and onError.fieldErrors after a rejected submit(). Both use the same FieldError shape, so a single renderer covers both surfaces.

Error shape

Gate submission on complete

The reliable signal for enabling your submit button is onChange.complete. It already accounts for required, format schemas, custom validate callbacks, and (for compound elements) sub-element state.
Do not infer validity from value !== null. Some elements emit partial typed shapes mid-typing; that is intentional and does not mean the value is valid.

Render inline errors from onChange.errors

The same FieldError[] appears on onError.fieldErrors after a rejected submit. Reuse the same renderer.

Render submit-time errors from onError.fieldErrors

  • Switch on code (the union is closed but new codes are added in minor releases, so keep a default branch).
  • Render message as-is; it is already localized and shopper-safe.
  • Do not surface cause; it carries raw diagnostics intended for observability.

Layer custom rules with validate

To add rules on top of the built-ins, leave validate unset and gate your business logic elsewhere (a server-side check, or inside your own onChange handler). To replace the built-ins entirely, pass a validate callback:
validate opts the element fully out of built-in checks; the callback owns the entire contract. See validate.

Bucket Checkout errors by source

Inside Checkout, every emitted FieldError carries a source string identifying which slot of the value envelope the field belongs to:
source maps 1:1 to top-level keys on CheckoutElementValue.

Bank key rotation

If your server rejects an encrypted bank payload with a UNKNOWN_KID error (an expected condition during key rotation), call overflow.invalidateBankFieldEncryptionCache() and retry bank.submit() once. Checkout wires this automatically; standalone bank flows should mirror the pattern:
For merchant-facing messaging during outages of this kind, prefer “manual bank entry may be temporarily unavailable” rather than exposing the underlying condition.

See also

Last modified on July 22, 2026