stripe / stripe-terminal-android

Stripe Terminal Android SDK
https://stripe.dev/stripe-terminal-android/
Other
94 stars 46 forks source link

Version 2.23 updatePaymentIntent(true) CollectConfiguration Tap To Pay Issue with Physical Test Card #418

Closed dev2442422 closed 8 months ago

dev2442422 commented 10 months ago

Summary

Hello,

We are running into an issue specifically when using the following CollectionConfiguration setup on version 2.23.3 and Android Tap to Pay. We are using the Stripe issued physical test card to attempt to make a payment in our test environment.

We use the following line of code to create a CollectConfiguration:

       CollectConfiguration collectConfig = new CollectConfiguration.Builder()
                .updatePaymentIntent(true)
                .build();

We then call Terminal.getInstance().collectPaymentMethod passing in the paymentIntent and collectConfig.

Finally we process the Payment using Terminal.getInstance().processPayment passing in the payment intent. Rather than Terminal.getInstance().processPayment calling back in the onSuccess method like it does in our flows when we use a bluetooth reader, it is instead calling back into the onFailure method.

Here are some logs noticed in logcat which may be helpful:

class=OnlineDirectResourceRepository message="Collectible payment is null in processPayment!"

E class=TerminalSession java.lang.NullPointerException at com.stripe.stripeterminal.internal.common.api.ApiRequestFactory.confirmPaymentIntent(ApiRequestFactory.kt:294) at com.stripe.stripeterminal.internal.common.api.ApiClient.confirmPaymentIntent(ApiClient.kt:107) at com.stripe.stripeterminal.internal.common.resourcerepository.OnlineDirectResourceRepository.processPayment(OnlineDirectResourceRepository.kt:328) at com.stripe.stripeterminal.internal.common.resourcerepository.DirectResourceRepositoryRouter.processPayment(DirectResourceRepositoryRouter.kt:152) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$processPayment$1.invoke(ProxyResourceRepository.kt:89) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$processPayment$1.invoke(ProxyResourceRepository.kt:88) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.withCurrentRepository(ProxyResourceRepository.kt:145) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.processPayment(ProxyResourceRepository.kt:88) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ProcessPaymentOperation.executeIfNotCanceled(TerminalSession.kt:1952) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CancelableOperation.execute(TerminalSession.kt:1021) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:979) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:838) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)

class=TerminalSession com.stripe.stripeterminal.external.models.TerminalException: Unexpected failure at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:842) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Caused by: java.lang.NullPointerException at com.stripe.stripeterminal.internal.common.api.ApiRequestFactory.confirmPaymentIntent(ApiRequestFactory.kt:294) at com.stripe.stripeterminal.internal.common.api.ApiClient.confirmPaymentIntent(ApiClient.kt:107) at com.stripe.stripeterminal.internal.common.resourcerepository.OnlineDirectResourceRepository.processPayment(OnlineDirectResourceRepository.kt:328) at com.stripe.stripeterminal.internal.common.resourcerepository.DirectResourceRepositoryRouter.processPayment(DirectResourceRepositoryRouter.kt:152) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$processPayment$1.invoke(ProxyResourceRepository.kt:89) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository$processPayment$1.invoke(ProxyResourceRepository.kt:88) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.withCurrentRepository(ProxyResourceRepository.kt:145) at com.stripe.stripeterminal.internal.common.resourcerepository.ProxyResourceRepository.processPayment(ProxyResourceRepository.kt:88) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ProcessPaymentOperation.executeIfNotCanceled(TerminalSession.kt:1952) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CancelableOperation.execute(TerminalSession.kt:1021) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:979) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:838) at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0)  at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4)

When we look at exception.getPaymentIntent() in the onfailure flow, it is null. Looking at https://stripe.dev/stripe-terminal-android/v2/core/com.stripe.stripeterminal/-terminal/process-payment.html?query=fun%20processPayment(intent:%20PaymentIntent,%20callback:%20PaymentIntentCallback) image this indicates the request to Stripe's servers timed out.

When we look at exception.getErrorCode() - we also get the following result: UNEXPECTED_ERROR.UNEXPECTED_SDK_ERROR .

We are unsure as to what could be causing this issue and why our flows would work great with bluetooth readers but throw an UNEXPECTED_ERROR.UNEXPECTED_SDK_ERROR when using tap to pay.

It looks like a payment is able to go through with updatePaymentIntent(false)

  1. Does Tap to Pay for Android support the Stripe physical test card in a test environment?
  2. Is there a known issue or issue with using updatePaymentIntent(true) on collectConfig in version 2.2+ for Tap to pay on Android?

Android version

13

Impacted devices (Android devices or readers)

Tap To Pay Galaxy A13

SDK version

2.23.3, also appears to be an issue on 2.23.1

sjl-stripe commented 9 months ago

Does Tap to Pay for Android support the Stripe physical test card in a test environment?

Yes, the Stripe test card is supported for testing Android Tap to Pay

Is there a known issue or issue with using updatePaymentIntent(true) on collectConfig in version 2.2+ for Tap to pay on Android?

It's not a known issue. Is the issue you're experiencing consistently reproducible? If so, can you repro it and provide a payment intent ID so we can investigate further? Thanks.

chr-stripe commented 8 months ago

Hi @dev2442422, I am able to reproduce this issue on the same 2.23.3 version when using Android Tap to Pay, however this seems to be resolved as of 3.1.0 and later. I would recommend you update to a later version in order to pick up this fix for using updatePaymentIntent with Android Tap to Pay.

As a reminder, the processPayment() method has been renamed to confirmPaymentIntent() in version 3.0.0 and later. Consult the SDK Migration Guide for the full list of changes in version 3.X.