#zdenkolini

1 messages ยท Page 1 of 1 (latest)

mortal fulcrumBOT
shell sparrow
#

Card holder name might be good enough

haughty tartan
#

Hello ๐Ÿ‘‹
I don't think AddressElement supports customization for the fields yet

shell sparrow
#

yes it doesn't, but it also doesn't update when the display.name property changes.
if I set something else other than 'full' | 'split' | 'organization' then it throws an error, so it does react to the change, but doesn't update the UI

haughty tartan
#

What error are you seeing exactly?

shell sparrow
#

I mean its not relevant to my original issue, but here:

IntegrationError
Invalid value for address.update(): display.name should be one of the following strings: full, split, organization. You specified: orgaddnization.
haughty tartan
#

Can you share the code you're working with?

shell sparrow
#

not really, but its basically just

function MyComponent() {
  const elements = useElements();
  const [isOrg, setIsOrg] = useState(false);

  useEffect(() => {
    const addressElement = elements.getElement('address');
    addressElement?.update({ display: { name: isOrg ? 'organization' : 'full' } });
  }, [isOrg, elements]);

  return (
    <div>
      <button onClick={() => setIsOrg(prevState => !prevState)}>hello</button>
      <AddressElement
        options={{
          display: { name: isOrg ? 'organization' : 'full' },
        }}
      />
    </div>
  );
}
haughty tartan
shell sparrow
#

yup, thought so.
could this be a feature request?

haughty tartan
#

Sure thing

shell sparrow
#

either the update property, or to have "Card holder name" as the label

haughty tartan
#

Just submitted the feedback ๐Ÿ™‚