In the next major version, we should remove support for the PostalCodeElement as it is no longer the recommended way to collect postal code. Users are suggested to build their own postal code input.
Is there a way I can hide by passing a prop to the element ?
@isuruAb, why not just not render the Element? Can you share a bit more about what you're trying to do?
(If you're looking to hide the postal code field in the combined card Element, you can pass in hidePostalCode=true).
@atty-stripe What is the correct way to determine if we need to collect post code information?
@streamich right now we recommend always collecting it as it helps detect fraud better. That said, we see banks in the US, UK, and Canada frequently implementing postal code checks, so you should at least collect it when the card's billing address is in those countries.
@atty-stripe sorry, to bother you again. The card Stripe element hides/shows the postal code input dynamically depending on the card number. What is that logic? Is it based on country?
How to add postal code to tokenization process if this component is going to be removed?
I mean, there is no way to add extra data to stripe.createToken() without providing element as first argument
@streamich the card Element uses the card number's BIN (first 6 digits) to predict which country it belongs to, but this is error-prone as documented in #20. We recommend specifically asking your users for the billing country, and using that to ask for the postal code.
@SergeyShablenko stripe.createToken accepts the postal code as address_zip. When using react-stripe-elements, the Element is automatically inferred for you, so you can just pass it in as stripe.createToken({ address_zip: '12345' }). See the reference for details: https://stripe.com/docs/stripe-js/reference#stripe-create-token.
Has the PostalCodeElement been removed?
If yes can you tell me in which version can I find one?
Has the PostalCodeElement been removed?
If yes can you tell me in which version can I find one?
I think -- in v2.0.3
https://unpkg.com/browse/[email protected]/src/index.js
Most helpful comment
@streamich the
cardElement uses the card number's BIN (first 6 digits) to predict which country it belongs to, but this is error-prone as documented in #20. We recommend specifically asking your users for the billing country, and using that to ask for the postal code.@SergeyShablenko
stripe.createTokenaccepts the postal code asaddress_zip. When using react-stripe-elements, the Element is automatically inferred for you, so you can just pass it in asstripe.createToken({ address_zip: '12345' }). See the reference for details: https://stripe.com/docs/stripe-js/reference#stripe-create-token.