android - Is it neccessary to use locationId for connecting reader with Stripe Termial? - Stack Overflow

I am working with Stripe terimnal with wisepad 3 reader. The reader got discovered during discovery pha

I am working with Stripe terimnal with wisepad 3 reader. The reader got discovered during discovery phase but it is not getting connected. We are not using Location for now.

It is written in the documentation that :

To connect to a reader, your backend needs to give the SDK permission to use the reader with your Stripe account by providing it with the secret from a ConnectionToken. Your backend should only create connection tokens for clients that it trusts. ​​If you’re using Stripe Connect, you should also scope the connection token to the relevant connected accounts. ​​If using locations, you should pass a location ID when creating the connection token to control access to readers.

From documentation it seems it is optional to use location. But in the configuration of connect code it is neccessary to provide location id. I would like to know is it possible to connect reader with out using location id.

My current code for connect is :

private fun connectToReader(reader: Reader, result: MethodChannel.Result) {

    val bluetoothReaderListener = TerminalBluetoothReaderListener()

    val connectionConfig = ConnectionConfiguration.BluetoothConnectionConfiguration(
        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)
        }
    })
}

I am working with Stripe terimnal with wisepad 3 reader. The reader got discovered during discovery phase but it is not getting connected. We are not using Location for now.

It is written in the documentation that : https://docs.stripe/terminal/quickstart?reader=wp3

To connect to a reader, your backend needs to give the SDK permission to use the reader with your Stripe account by providing it with the secret from a ConnectionToken. Your backend should only create connection tokens for clients that it trusts. ​​If you’re using Stripe Connect, you should also scope the connection token to the relevant connected accounts. ​​If using locations, you should pass a location ID when creating the connection token to control access to readers.

From documentation it seems it is optional to use location. But in the configuration of connect code it is neccessary to provide location id. I would like to know is it possible to connect reader with out using location id.

My current code for connect is :

private fun connectToReader(reader: Reader, result: MethodChannel.Result) {

    val bluetoothReaderListener = TerminalBluetoothReaderListener()

    val connectionConfig = ConnectionConfiguration.BluetoothConnectionConfiguration(
        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)
        }
    })
}
Share Improve this question edited Nov 20, 2024 at 15:29 sai asked Nov 19, 2024 at 9:30 saisai 535 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Yes, location id is necessary. First you have to add location in your stripe account terminal dashboard. Then if the endpoint for getting location id is not implemented on your backend then your team have to implement it. https://docs.stripe/api/terminal/locations/retrieve After that you can get location id from your backend on frontend side by calling your backend api.

And depending on which type of reader you are using you can register your reader by following this:

https://docs.stripe/terminal/fleet/register-readers?terminal-sdk-platform=android

You must register your reader to a location upon connection.

https://docs.stripe/terminal/payments/connect-reader?terminal-sdk-platform=android&reader-type=bluetooth#connect-reader

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745570876a4633674.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信