ConnectionProvider
The mandatory protocol used to create a Embedded Payments connectionSecret
. The createConnection()
function should return a valid connectionSecret
string from your server.
This connection secret is required in order to connect to the proximity reader on the device.
public protocol ConnectionProvider {
func createConnection() async throws -> String
}
Functions
async throws createConnection() -> String
Function that sends the request to your endpoint to create a connection.
attention
Do not cache or hardcode the connectionSecret
. Tyro already manages the lifecycle of this secret.
Returns
connectionSecret
string.
Throws
Throw an Error if something went wrong.
Implementation
// Swift Sample Code
...
import Foundation
import TyroTapToPaySDK
class MyConnectionProvider : ConnectionProvider {
public func createConnection() async throws -> String {
// Your implementation should retrieve a unique connectionSecret from your POS systems.
return "f310e43b-a6c9-4c43-9535-ff68b2b9c4a1"
}
}