Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap to pay on NFC enabled mobile phone shows TAP TO SIMULATE PAYMENT screen always instead on waiting for real card #330

Closed
ajithv11 opened this issue May 23, 2023 · 3 comments
Labels
Tap to Pay Issues with the Stripe Tap to Pay localmobile reader

Comments

@ajithv11
Copy link

Hi,
Tap to pay on NFC supporting mobile phone shows TAP TO SIMULATE PAYMENT screen always instead of waiting for real card, It happens when I update stripe terminal version to 2.20.1. The code used is given below

   if (discoveryTask == null && Terminal.getInstance().connectedReader == null) {
        val config = DiscoveryConfiguration(
            timeout = 0,
            discoveryMethod = DiscoveryMethod.LOCAL_MOBILE,
            isSimulated = true,
            location = Constants.LOCATIONID
        )
        discoveryTask = Terminal.getInstance().discoverReaders(config,
            discoveryListener = object : DiscoveryListener {
            override fun onUpdateDiscoveredReaders(readers: List<Reader>) {

                val firstReader = readers.first();
                this@TapViewModel.reader.postValue(firstReader);
                val config = ConnectionConfiguration.LocalMobileConnectionConfiguration(Constants.LOCATIONID);
                Terminal.getInstance().connectLocalMobileReader(firstReader, config,
                    
                    object : ReaderCallback {

                        override fun onSuccess(reader: Reader) {
                            val params = PaymentIntentParameters.Builder().setAmount(amt*100).setCurrency(Constants.CURRENCY).build();
                            Terminal.getInstance().createPaymentIntent(params, object: PaymentIntentCallback {
                                override fun onSuccess(paymentIntent: PaymentIntent) {
                                    val collectConfig = CollectConfiguration.Builder().updatePaymentIntent(true).build();
                                    val cancelable = Terminal.getInstance().collectPaymentMethod(paymentIntent,
                                        object : PaymentIntentCallback {
                                            override fun onSuccess(paymentIntent: PaymentIntent) {

                                                Log.d("Response Tap", "paymentIntent Before : "+paymentIntent.id)

                                                Terminal.getInstance().processPayment(paymentIntent, object :
                                                    PaymentIntentCallback {
                                                    override fun onSuccess(paymentIntent: PaymentIntent) {
                                                        // Placeholder for notifying your backend to capture paymentIntent.id TODO
                                                        Log.d("Response Tap", "paymentIntent Success : "+paymentIntent.id)
                                                        
                                                    }

                                                    override fun onFailure(exception: TerminalException) {
                                                        Log.d("Response Tap", "paymentIntent Error : "+paymentIntent.id)
                                                        
                                                    }
                                                })
                                            }

                                            override fun onFailure(exception: TerminalException) {
                                                Log.d("Response Tap", "paymentIntent Error : "+exception.errorMessage )
                                            }
                                        })



                                }
                                override fun onFailure(exception: TerminalException) {
                                    Log.d("Response Tap", "paymentIntent Error : "+exception.errorMessage )
                                }
                            })
                        }
                        override fun onFailure(e: TerminalException) {
                            Log.d("Response Tap", "paymentIntent Error : "+e.errorMessage )
                        }
                    });
            }
            },
            object : Callback {
                override fun onSuccess() {
                    discoveryTask = null
                    //Log.d("Response Tap", "Readers Discovered Success!");
                }
                override fun onFailure(e: TerminalException) {
                    discoveryTask = null
                    Log.d("Response Tap", "Reader Discovery Failed : " + e.errorMessage);
                     
                }
            })
    }

Do I need to change anything on the above code for making tap card enabled? It was working and wait for real card on version 2.17.1

Screenshot of version 2.17.1 which if fine

Screenshot_20221124-174019_SiftDonate

Screenshot of version 2.20.1 : Issue I need real tap card here
Screenshot_20230523_194632_SwiftDonate

Same happens on both stripe test mode and live mode

@rscherf
Copy link

rscherf commented May 23, 2023

It appears that you have set:

isSimulated = true

I imagine this should be set to false.

@ajithv11
Copy link
Author

@rscherf You said it :) Thanks a lot

So I believe in previous version, There is no simulation option in LocalMobileConnection, In the later version 2.20.1 simulation is available, so the isSimulated = true comes into effect.

@maggiewhite-stripe maggiewhite-stripe added the Tap to Pay Issues with the Stripe Tap to Pay localmobile reader label May 26, 2023
@maggiewhite-stripe
Copy link
Contributor

Thanks @rscherf!

@ajithv11 Yes, we added support for the simulated Tap to Pay reader in 2.18.1:
https://github.com/stripe/stripe-terminal-android/blob/master/CHANGELOG.md#2181---2023-03-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tap to Pay Issues with the Stripe Tap to Pay localmobile reader
Projects
None yet
Development

No branches or pull requests

3 participants