medipass / react-credit-card-input

💳 A credit/debit card input field for React
MIT License
279 stars 67 forks source link

Keep getting "Card number is invalid" #58

Open TommyLeong opened 4 years ago

TommyLeong commented 4 years ago
Screenshot 2020-07-05 at 9 46 52 PM

Nothing fancy done on the code. But the field cardNumber keeps returning me INVALID even if I key in the following

Am I missing something?

<CreditCardInput
            fieldStyle={
              state.paymentDetailsError ? { border: "1px solid red" } : {}
            }
            cardNumberInputProps={{
              value: state.cardNumber,
              onChange: handleCardNumberChange,
            }}
            cardExpiryInputProps={{
              value: state.expiry,
              onChange: handleCardExpiryChange,
            }}
            cardCVCInputProps={{
              value: state.cvc,
              onChange: handleCardCVCChange,
            }}
            fieldClassName="input"
          />
olitomas commented 3 years ago

That is because 4343 4343 4343 4343 is invalid.

See more about valid credit cards here: https://www.validcreditcardnumber.com/

TommyLeong commented 3 years ago

@olitomas Good info about the link you shared (Luhn Algorithm Check), but I've tried with my actual VISA credit card as well and it didn't get passed either. Why was that?

olitomas commented 3 years ago

Thats kind of hard to know without knowing your credit card number.... and sending a stranger on the internet your credit card number is a recipe for a bad time! So you are going to have to figure that one out for your self 😉