Appearance example
Supported event pattern
card.off("change", handler) when your component unmounts if your framework keeps the same card instance alive across renders.
Event payloads
ready fires when the hosted iframe is loaded. It does not mean the card details are valid.
change fires whenever card input changes:
brand is null. When the current state is valid, errors is empty and valid is true.
error fires when the hosted field fails to load or receives a payment failure outside an active tokenization request:
Invalid states
Usechange.valid as the only submit gate. Do not infer validity from the card brand alone.
errors object is keyed by the hosted field that needs attention. The exact keys are controlled by the hosted card field, so render the messages rather than hardcoding every possible key.
Fix: confirm the script version, environment, and publicKey. Event handlers should update UI state only; final payment state still comes from your backend and webhooks.
