stripe / stripe-android

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

Adding card using NFC and/or card.io #486

Closed ahaverty closed 9 months ago

ahaverty commented 6 years ago

Hi Stripe, feature request/discussion: A lot of Android's have the ability to read cards with NFC/contactless with a library like this https://github.com/pro100svitlo/Credit-Card-NFC-Reader

We're thinking of integrating that library + use stripe's programmatical .set's Is this something that could be added to Stripe's library? I haven't seen any apps other than demo apps using contactless, does anyone have any thoughts on security/UX?

We'd also like to give the option to use the camera to add. Something like card.io, but the android library seems to be in a poor state. Is that something Stripe could ever work on?

ksun-stripe commented 6 years ago

Hi @ahaverty! Thanks for writing in with the suggestions :)

I want to make sure I understand the suggestions/questions:

ahaverty commented 6 years ago

Hi @ksun-stripe I'm wondering if stripe can add either/both. I'd also like to hear if Stripe have any thoughts on the UX/security of either libraries/methods in the meantime.

This stripe library seems to be in great shape! I meant that the card.io android library has been in ruin for the last year.

iOS cardio is usable, surely android could have some great image/NFC libraries. I'm wondering why either aren't popular, maybe it's something I haven't thought of? Thanks for the help 👌

anelder-stripe commented 6 years ago

@ahaverty - I can't speak to everything here, but EMV (of which NFC is ~classified; thanks to ISO/IEC 14443) is a murky area. EMV (theoretically) requires hardware certification on a per device, per partner, per territory, and per card brand basis, as far as I know. Meaning, adding support for this is arguably a violation of the card network's terms. It's murky though, because it's tough to say if that's really true for cell phones.

From an Engineering perspective though, I love the idea of using NFC for this. So simple! I'm gonna ask around and see if anyone else has thoughts on this.

ksun-stripe commented 6 years ago

Moving this to our internal task tracking system so we can get it prioritized. :) https://jira.corp.stripe.com/browse/ANDROID-196 (internal only link for tracking purposes)

jkscheung commented 6 years ago

@ksun-stripe Any status update on this issue please? Card.io support would be greatly appreciated!

ahaverty commented 5 years ago

Hi @ksun-stripe, any update on that internal ticket? Revolut.com have it in their android app 🤔 screenshot_20181024-163240

evanjmg commented 5 years ago

Any update on this?

IrinaBulygina commented 5 years ago

@ksun-stripe @anelder-stripe hey! Any updates on this?

mshafrir-stripe commented 5 years ago

@IrinaBulygina thanks for resurfacing this issue. We're starting to investigate a card scan solution for our Android SDK. I'll share further updates here.

jamiejackherer commented 4 years ago

Very interested bro see what happened here. I have seen lots about the NFC payment method but yet to see it's possible

ChiragSavsani commented 4 years ago

May I know the status of Card scan functionality? When It will be available for use?

mshafrir-stripe commented 4 years ago

@ChiragSavsani I don't have any updates to share at this time, but you can follow this issue to be notified of any future updates.

thebillington commented 4 years ago

@mshafrir-stripe is there an update on this functionality? One of our clients explicitly wants card scan functionality, we chose Stripe as we know it is supported on the iOS version by default with the Stripe prebuilt components.

If there are no plans to add this functionality then would it be possible to do so with a custom implementation without using the pre-built components? I would like to know for certain before I set out to rebuild from the ground up .

I'm not sure of the complexity of building a Stripe integration myself, where would I find good documentation for use of the components such as CardInputWidget? Would using a CardInputWidget allow me to scan the card details and populate the card info from the scan callback? Would implementing these myself require extensive backend changes?

Any advice much appreciated.

jameslevine commented 4 years ago

Would be great to know if there is any update on this?

thebillington commented 4 years ago

@jameslevine doesn't seem the Stripe team are doing any work on this right now, hopefully there'll be a proper solution soon.

In the meantime I setup my own solution with the help of our web team. For the API when you create an account, send a request to Stripe to create a new customer and then create endpoints for:

All of this can be setup on the Android side as well, but a lot of our payment logic was already on the backend so we decided to make the changes there.

In app all you have to do is create an Activity that allows you to add a new payment method, with a button to start card.io:

mBinding.scanButton.setOnClickListener { 
    startActivityForResult(Intent(this, CardIOActivity::class.java), CARD_IO_SCAN)
}

Then handle the returned card details:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (requestCode == CARD_IO_SCAN) {
        data?.getParcelableExtra<CreditCard>(CardIOActivity.EXTRA_SCAN_RESULT)?.let { creditCard ->
            mBinding.cardNumberTextInputLayout.setText(creditCard.formattedCardNumber)
        }
    }
    super.onActivityResult(requestCode, resultCode, data)
}

Finally a call to your server to create the card:

private fun createPaymentCard(cardNumber: String?) {
    CallToServer.submitCardDetails(cardNumber)?.observe(this, Observer {
        if (it.status == Status.SUCCESS) {
            CoroutineScope(Dispatchers.IO).launch { AppDatabase.database.paymentCardModelDao().setDefaultCard(it.data?.paymentMethodID) }
            finish()
        } else {
            // Handle errors
        }
    })
}

Then I just created another Activity that would fetch all PaymentMethods from the server and display them in app, with the ability to delete/select a PaymentMethod to be used for any payment. When making a payment I just send the PaymentMethodID for the default card, or whichever the user has selected.

Hope that's helpful and gives enough info, the work took a lot less time than I had originally thought it would.

DomenicBianchi01 commented 3 years ago

Any updates on this? Would be awesome if Stripe for Android had the same scanning feature as the iOS version!

jamesdixon commented 3 years ago

I second what @DomenicBianchi01 said 👍

cmbaykal commented 3 years ago

Any updates on this?

mshafrir-stripe commented 3 years ago

Thanks for your feedback. We don't have any updates to share at this time, but will keep this issue posted if anything changes.

bnandhinidevi commented 3 years ago

Hi, is there any update on card scan in android stripe SDK

aiKrice commented 3 years ago

Any update ? Ineterrested in as well

eduprat-chwy commented 3 years ago

Any update ? Ineterrested in as well

awush-stripe commented 3 years ago

Hello! Stripe recently acquired Bouncer, which is a native android and iOS card scanning library (see https://getbouncer.com/scan and https://github.com/getbouncer/cardscan-android). Bouncer is presently working on integrating its card scanning technology into the stripe android and iOS SDK, with an anticipated release date in early 2022.

Dave181295 commented 2 years ago

Okay so Stripe just announced the ScanCard feature, but I don't see any doc about it, I saw the repo , need to create a CIV intent , any infos please?

awush-stripe commented 2 years ago

hi @Dave181295 , Stripe card scanning will release today, and will not require a CIV intent. CIV intent is for a future product.

Dave181295 commented 2 years ago

That's fantastic news! When will Stripe's docs be updated? @awush-stripe

awush-stripe commented 2 years ago

hi @Dave181295 we're working on the docs presently, and we'll likely be making some small API tweaks. Expect an update in the next few weeks.

upside-sarah commented 2 years ago

@awush-stripe is there an update on this? are the docs up-to-date?

maulik-vegans commented 1 year ago

Hello , Any updates on having scan card option for android same like in IOS ?

E-Pebl commented 1 year ago

Any updates on this?

E-Pebl commented 1 year ago

hi @Dave181295 we're working on the docs presently, and we'll likely be making some small API tweaks. Expect an update in the next few weeks.

Hi, any updates on this at all! Appreciate it.

awush-stripe commented 1 year ago

Hello all, apologies for the pretty extreme delay here, I lost this thread!

We have some basic documentation for using the OCR within the README of the stripecardscan section of our SDK https://github.com/stripe/stripe-android/tree/master/stripecardscan#credit-card-ocr

Additionally, card scanning can be enabled in the payments SDK by including the stripecardscan SDK in your project. The payments SDK will automatically detect the card scan SDK and display the card scanner button within the credit card entry form.

sfriedman-stripe commented 9 months ago

Closing this issue given the stripecardscan info above. Please feel free to open a new issue with any further feedback!