Breaking Change: Address Element State Formatting
Stripe.js has changed how the Address Element handles the state property. The getValue() method and address change events now return the state value in Latin character formatting by default, instead of matching the user's browser locale.
What Changed
- Before: The
statefield returned values formatted according to the user's browser locale - After: The
statefield defaults to Latin character formatting - The address change event always returns Latin-formatted
statevalues
Migration Steps
If your application expects localized state values, you need to update your code:
For getValue() calls: Pass the
format: 'localized'option to retrieve browser-localized values:addressElement.getValue({format: 'localized'})For change events: Call
getValue({format: 'localized'})within the event callback to retrieve localized valuesFor stored expectations: Update any code that parses or validates
statevalues to expect Latin characters by default
Context
This change is part of Stripe's Dahlia API version and is accompanied by several other breaking changes to Elements and Stripe.js, including updates to the Payment Element configuration, the elements.update() method, and removal of deprecated methods.