expo / stripe-expo

Use the Stripe HTTP API in Expo without the DOM, node, or native deps
MIT License
159 stars 23 forks source link

The premise under "Features" seems false #21

Open jhalborg opened 6 years ago

jhalborg commented 6 years ago

Hello,

It seems to me that the premises under "Features" are false:

"Collect credit card information and convert it to a Stripe token in a single line of Javascript"

As far as I understand the library, it does not offer any tools to collect card information (checkout flow, UI elements or the like), but should instead read

"Convert credit card information to a Stripe token in a single line of Javascript"

slorber commented 6 years ago

@jhalborg you can collect card data with https://github.com/sbycrosz/react-native-credit-card-input and then send that data with this lib, get a token and send it to your backend.

  handleConfirm = () => {
    const {onCreditCardToken} = this.props;
    const {
      form: {
        values: {
          number,
          expiry,
          cvc,
        }
      }
    } = this.state;
    const stripe = getStripeClient();
    const card = {
      "number": number,
      "exp_month": expiry.split("/")[0],
      "exp_year": "20" + expiry.split("/")[1],
      "cvc": cvc
    };
    console.debug("Stripe createToken",card);
    const tokenPromise = stripe.createToken({
      card,
    });
    ...
  };
jhalborg commented 6 years ago

Sure, or build it from the ground up :-) But that still makes the statement

"Collect credit card information and convert it to a Stripe token in a single line of Javascript"

false ;-)