stripe-terminal-react-native: [Tap To Pay] Reader has been disconnected unexpectedly on Android devices

Describe the bug After putting the Android app in the background for some time, then reopening the app to do the first Tap to Pay transaction causes the following issue happens:

[Stripe terminal]: didReportUnexpectedReaderDisconnect { message: 'Reader has been disconnected unexpectedly',
  code: 'UNEXPECTED_ERROR.UNEXPECTED_SDK_ERROR' }

It happened after after creating the Payment Intent by the createPaymentIntent function and before the collectingPaymentMethod function executes. Then the collectingPaymentMethod function throws this error, which causes the transaction to fail:

{ code: 'INTEGRATION_ERROR.NOT_CONNECTED_TO_READER',
  message: 'LocalMobile reader is not connected' }

To Reproduce Steps to reproduce the behavior:

  1. Put app to the background for a while (eg. more than 2 hours).
  2. Reopen the app, start the first transaction.
  3. Tap To Pay screen appears, try to tap a card.
  4. The issue above happens.

Expected behavior

The Reader should not be disconnected unexpectedly when doing the transaction.

Stripe Terminal React Native SDK version

  • ^0.0.1-beta.17
  • ^0.0.1-beta.18

Smartphone (please complete the following information):

  • Device: Google Pixel 3a
  • OS: Android 12

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 22 (1 by maintainers)

Most upvoted comments

@tzecheng the solution for us has been to disconnect the reader after every success/failure and make sure we are connecting from scratch whenever the user initiates the payment flow.

I mentioned this above in a comment a few months back - it seems that there are some issues with the library maintaining a synchronised connection state with the OS.

This is not necessary on iOS, but the Android side has a lot of Tap to Pay bugs and a degraded experience. See #809 for more problems

Worth understanding that this library is a wrapper for closed-source iOS and Android SDKs, which are often several versions ahead of the pinned version here, so it’s very difficult for us to debug.