Before integrating the SDK, you should create an endpoint on your backend server that creates a new connection token via the Stripe Terminal API. The connection token is used by the SDK to connect to a reader.
An overview of the lifecycle of a connection token:
When Stripe Terminal is initialized, the SDK attempts to proactively request an connection token from your backend server.
The SDK uses the connection to connect to a reader.
Subsequent calls to connect require a new connection token. If you disconnect from a reader, and then call connect again, the SDK will need a new connection token from your backend server.
We suggest making your application's API client conform to this protocol.
For more information, see the official Stripe docs: Connection Token
Use of this SDK is subject to the Stripe Terminal Terms: https://stripe.com/terminal/legal
void fetchConnectionToken(@NotNull ConnectionTokenCallback callback)
Fetches a connection token from your backend server.
On your backend server, use the
/v1/terminal/connection_tokens endpoint to
create a connection token, and return the
connection_token from the response
to your app. In your app, call the callback with the connection token,
or an error if fetching the token failed.
callback- Call this with a connection token, or an error if creating the connectiontoken failed.