stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.28k stars 644 forks source link

Cannot enter 19-digit CreditCards with CardMultilineWidget #2940

Closed juschmitt-ioki closed 4 years ago

juschmitt-ioki commented 4 years ago

Summary

We're currently in the process of updating the Stripe SDK in our project to the latest Version (16.0.1) and read in your migration guide, that with this version, we should be able to enter 19-digit CreditCards using the CardMultilineWidget. We're already using this Widget, but are not able to enter any 19-digit CreditCard no matter which Brand it is.

The CardNumberEditText just stops accepting inputs after entering 16 characters even though we're trying to enter a valid 19-digit CreditCard.

With upgrading to version 16.0.1 we also added the PaymentConfiguration.init call before we create the Fragment containing the CardMultilineWidget. Which is described in the migration guide as a must have to allow 19 digits. We also tried calling it on app start in our Application.onCreate which did not help.

From browsing the code of CardMultilineWidget and the CardNumberEditText it seems that the EditText only works with 14 and 16 digits depending on which Card brand it detects.

I am able to paste a 19-digit CreditCard, but when removing one character I am not able to enter it again.

Code to reproduce

This can be reproduced using the example project in this repo.

Android version

Android 10 Android 7.1

Impacted devices

Tested on a Pixel 3a (Android 10) and an Emulator (Android 7.1)

SDK version

Tested with Version 16.0.0 and Version 16.0.1

Other information

mshafrir-stripe commented 4 years ago

@juschmitt-ioki thanks for filing. Can you provide the BIN of the card number you are testing with?

juschmitt-ioki commented 4 years ago

@mshafrir-stripe Sure! Here are two that we tried:

VISA: 4539017541309771431 Discover: 6011423711019440124

These are just random valid 19-digit BINs, as the point is that we can't even enter them into the field.

smaskell-stripe commented 4 years ago

Hi @juschmitt-ioki. In order to support >16 digit cards, we have an internal web service that provides metadata such as the max length given the first few digits in a card. However, this service is currently only enabled for UnionPay branded cards.

See CardNumberEditText: https://github.com/stripe/stripe-android/blob/master/stripe/src/main/java/com/stripe/android/view/CardNumberEditText.kt#L448

We're definitely looking to expand this to other brands but don't have anything to communicate at this time. However, we definitely should have communicated this better and apologize for the confusion here!

juschmitt-ioki commented 4 years ago

Ah alright! No worries, I guess this can be closed then. Thank you guys for the quick responses.

mshafrir-stripe commented 4 years ago

@juschmitt-ioki the BIN for 4539017541309771431 has 16-digit numbers, so that number appears to be invalid to me. How did you generate it?

The BIN for 6011423711019440124 has 19-digit numbers, so that is a number we should support.

juschmitt-ioki commented 4 years ago

As we don't have any 19-digit CreditCards ourselves or Test Numbers, we generated them using some online tool which claims to generate valid numbers (which just wouldn't work without the expiry date and cvc).

I was under the impression that, as long as the CreditCard number can be verified using the Luhn Algorithm they should at least work for entering them into the Card number input field.

StefMa commented 4 years ago

Does it make sense to update the stripe testing page and add a valid 19 digits card there? 🤔