英文:
Stripe card reader location is coming null on Android
问题
我们正面临着连接读卡器到Android应用程序的问题。以下是我们正在执行的步骤:
1- 打开读卡器:我们使用的是 "Stripe Reader M2"。我们轻按读卡器上的按钮,它的灯会亮起然后再次熄灭。我们认为它已经打开。
2- 连接读卡器:首先,我们进入Android的蓝牙设置并在那里配对读卡器。看起来它成功配对,所以我们认为读卡器已经打开。
3- 在Android上,我按照文档的说明尝试发现设备。
val config = DiscoveryConfiguration(20, DiscoveryMethod.BLUETOOTH_SCAN, false)
Terminal.getInstance().discoverReaders(config, object : DiscoveryListener {...}, object : Callback {...})
问题:我收到了名为 "onUpdateDiscoveredReaders" 的回调,在那里我看到了读卡器,但读卡器的位置->id为 'null'。它的标签和id也都是 'null'。它的serialNumber是上面的字符串 "STRM2..."。
另外,我在discoverReaders的onFailure回调中收到了错误 BLUETOOTH_SCAN_TIMED_OUT。
我需要在BluetoothConnectionConfiguration中获取 "reader->location->id"。
如果我在DiscoveryConfiguration中将isSimulated设置为true,那么它可以工作,并且模拟的读卡器可以连接。
请指导我们缺少什么。
英文:
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.
答案1
得分: 1
reader.location如果尚未注册到位置,则为null - 请参阅https://stripe.com/docs/terminal/fleet/locations了解更多详情
如果尚未执行以下操作,您应该:
- 创建位置:https://stripe.com/docs/api/terminal/locations/create
- 将阅读器注册到位置:https://stripe.com/docs/terminal/fleet/locations#register-bluetooth-readers
英文:
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 :
- Create a location : https://stripe.com/docs/api/terminal/locations/create
- Register a reader to a location : https://stripe.com/docs/terminal/fleet/locations#register-bluetooth-readers
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论