{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"ConnectionProvider","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"connectionprovider","__idx":0},"children":["ConnectionProvider"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The mandatory protocol used to create a Embedded Payments ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]},". The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["createConnection()"]}," function should return a valid ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]}," string from your server."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This connection secret is required in order to connect to the proximity reader on the device."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"public protocol ConnectionProvider {\n  func createConnection() async throws -> String\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"functions","__idx":1},"children":["Functions"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"async-throws-createconnection---string","__idx":2},"children":["async throws createConnection() -> String"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Function that sends the request to your endpoint to create a connection."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"ATTENTION"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Do not cache or hardcode the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]},". Tyro already manages the lifecycle of this secret."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns","__idx":3},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]}," string."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"throws","__idx":4},"children":["Throws"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Throw an Error if something went wrong."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implementation","__idx":5},"children":["Implementation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\n...\nimport Foundation\nimport TyroTapToPaySDK\n\nclass SdkDemoConnectionProvider : ConnectionProvider {\n  public func createConnection() async throws -> String {\n    // Your implementation should retrieve a unique connectionSecret from your POS systems.\n    return \"f310e43b-a6c9-4c43-9535-ff68b2b9c4a1\"\n  }\n}\n","lang":"swift"},"children":[]}]},"headings":[{"value":"ConnectionProvider","id":"connectionprovider","depth":2},{"value":"Functions","id":"functions","depth":2},{"value":"async throws createConnection() -> String","id":"async-throws-createconnection---string","depth":3},{"value":"Returns","id":"returns","depth":4},{"value":"Throws","id":"throws","depth":4},{"value":"Implementation","id":"implementation","depth":4}],"frontmatter":{"title":"ConnectionProvider Protocol","seo":{"title":"ConnectionProvider"}},"lastModified":"2026-09-02T01:02:13.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/in-person-payments/tap-to-pay/ios/sdk/connection-provider","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}