# App Initialisation

## TyroTapToPay(environment: TyroEnvironment, connectionProvider: ConnectionProvider)


```swift
public convenience init(
  environment: TyroTapToPaySDK.TyroEnvironment,
  connectionProvider: TyroTapToPaySDK.ConnectionProvider
) throws
```

### Parameters


```json
{
  "type": "object",
  "properties": {
    "environment": {
      "type": "TyroEnvironment",
      "description": "An enumeration representing the available environments for use with Embedded Payments.",
      "enum": [
        "TyroEnvironment.sandbox",
        "TyroEnvironment.prod"
      ]
    },
    "connectionProvider": {
      "type": "ConnectionProvider",
      "description": "Your class that implements the Connection Provider interface which makes a call to your server to fetch the `connectionSecret`."
    }
  },
  "required": [
    "environment",
    "connectionProvider"
  ]
}
```

See [TyroEnvironment](/pos/embedded-payments/iphone/sdk/tyro-environment) for the different environments the SDK can be initialised with.

See [ConnectionProvider](/pos/embedded-payments/iphone/sdk/connection-provider) for information about the provider you need to implement to return a `connectionSecret`.

### Throws

#### TapToPaySDKError.tapToPayInitialisationError

Throws `TapToPaySDKError.tapToPayInitialisationError` if there was an issue determining the version of the SDK

See [TapToPaySDKError](/pos/embedded-payments/iphone/sdk/errors) for more information about errors.

## tapToPaySdk.connect() async throws

Prepares the Tyro Embedded Payments SDK to communicate with your POS integration server and the reader device


```swift
public func connect() async throws
```