Search code examples
androidnullstripe-payments

Stripe card reader location is coming null on Android


We are facing a problem connecting to the Card reader to Android app. Here are the steps we are following: 1- Turn on the card reader: We have "Stripe Reader M2". We tap the button on the reader, its lights turn on and then turn off again. We assume it is ON.

2- Connect the reader: We first go to Android Bluetooth settings and pair the reader there. It seems it gets paired successfully, so here we think that the Reader was ON.

3- On Android I followed the documentation, and tried to discover the device.

    val config = DiscoveryConfiguration(20, DiscoveryMethod.BLUETOOTH_SCAN , false) 
    Terminal.getInstance().discoverReaders(config, object : DiscoveryListener {...}, object : Callback {...})

  PROBLEM: I get the callback "onUpdateDiscoveredReaders" and there I see the reader, but the reader's location->id is 'null'. Its label and id  are also 'null'. Its serialNumber is the above string "STRM2..."
  Also, I am getting the error BLUETOOTH_SCAN_TIMED_OUT in onFailure Callback in discoverReaders.

    I need the "reader->location->id" in BluetoothConnectionConfiguration. 

    If I set isSimulated = true in DiscoveryConfiguration, then it works, and the simulated reader is connected. 

Please guide us on what is missing.


Solution

  • reader.location is null if the reader hasn't been registered to a location yet - see https://stripe.com/docs/terminal/fleet/locations for more details

    If you haven't yet done so, you should :

    1. Create a location : https://stripe.com/docs/api/terminal/locations/create
    2. Register a reader to a location : https://stripe.com/docs/terminal/fleet/locations#register-bluetooth-readers