You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Wisepad 3连接Stripe Terminal是否必须使用LocationId?

问题解答

核心结论

不能跳过LocationId完成Wisepad 3的连接——Stripe Terminal对蓝牙阅读器(包括Wisepad3)有强制要求:连接时必须关联一个有效的Location,文档里提到的“Location可选”指的是无需使用Location的地域限制、多门店管理等高级功能,但连接环节必须提供合法的LocationId,空字符串会直接导致连接失败。

解决步骤

  1. 创建Location:先在Stripe后台(测试或生产环境)创建一个Location,哪怕是测试用的虚拟地址也可以,不需要实际门店。
  2. 关联ConnectionToken:后端生成ConnectionToken时,必须传入这个LocationId,确保SDK拿到的令牌和该Location绑定。
  3. 修正前端代码:把你代码里的locationId = ""替换成后台生成的真实LocationId,示例如下:
private fun connectToReader(reader: Reader, result: MethodChannel.Result) {

    val bluetoothReaderListener = TerminalBluetoothReaderListener()

    val connectionConfig = ConnectionConfiguration.BluetoothConnectionConfiguration(
        locationId = "loc_123456789", // 替换为你的真实LocationId
        autoReconnectOnUnexpectedDisconnect = true,
        bluetoothReaderListener = bluetoothReaderListener
    )

    Terminal.getInstance().connectReader(reader, connectionConfig, object : ReaderCallback {
        override fun onSuccess(connectedReader: Reader) {
            Log.d("StripeTerminal", "Reader connected: ${connectedReader.serialNumber}")
            notifyFlutterReaderConnection(true)
            result.success("Reader connected successfully: ${connectedReader.serialNumber}")
        }

        override fun onFailure(e: TerminalException) {
            Log.e("StripeTerminal", "Error connecting to reader: ${e.message}")
            notifyFlutterReaderConnection(false)
            result.error("CONNECT_ERROR", "Error connecting to reader: ${e.message}", null)
        }
    })
}

补充说明

  • 测试环境下,你可以创建一个仅用于测试的Location,地址随便填即可;生产环境需要填写真实的经营地址,但Stripe不会强制验证地址的实际使用场景,只是作为阅读器的关联标识。
  • 如果不传入有效的LocationId,SDK会因为权限验证失败拒绝连接,这就是你当前无法完成连接的直接原因。

内容的提问来源于stack exchange,提问作者sai

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 04:17:09