tipsi/tipsi-stripe

How to fetch ZIP / Postal Code from PaymentCardTextField?

plowman opened this issue · 3 comments

The problem

PaymentCardTextField prompts the user to enter a zip / postal code, which is great. However, the onChange() callback doesn't seem to surface this field. (Or I'm looking in the wrong place).

Environment

  • tipsi-stripe version: 9.0.0
  • iOS or Android: iOS
  • OS version: 11.0+
  • React-Native version: 0.63.3

Code To Reproduce Issue (Good To Have)

class AddCardFormContainer extends Component {
  handleOnChange = (event) => {
    console.info("Looking at event: ", event);
  };

  render() {
    return (
      <PaymentCardTextField
        onChange={this.handleOnChange}
      />
    );
  }
}

Screen Shot 2021-04-29 at 3 49 12 PM

Once all the fields are entered, even the zip code, this outputs something like:

Looking at event: {"params": {"cvc": "999", "expMonth": 11, "expYear": 39, "number": "4242424242424242"}, "target": 2193, "valid": true}

Is there a way to get this postalCode out of AddCardFormContainer? Thanks in advance.

Earlier version of PaymentCardTextField didn't require the zipCode, I'd suggest rolling back. This issue is referenced here: #641 and it was labeled with Won't fix.

Personally, I would love a prop on the component to hide/disable the zipCode field as the UI fitting all these fields into the horizontal input is getting cumbersome and crowded. With the zipCode field hidden at first, it's often completely overlooked and the user is left confused.

Same issue here and I agree with you @kierangillen.

It would be great if we could remove the ZIP code field with a prop.
The UX is not good if we don't need that value.

Closing this ticket, so that new users don't think this project is still active.

Stripe does not want you using this, and you will find pain if you do; Please migrate to the official @stripe/stripe-react-native package, for your user's safety, and your developer's sanity!

See more: