{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Integrate SDK","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":1,"id":"integrate-sdk","__idx":0},"children":["Integrate SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Integrate with Tyro Embedded Payments SDK to accept in-person payments using a compatible iPhone device."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You will first need to implement ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/account-authorisation"},"children":["Account Authorisation"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An open source sample app is available at: ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/tyro/tyro-tap-to-pay-sdk-ios/tree/master/SampleApp"},"children":["Tyro Embedded Payments IOS Sample App"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview-of-embedded-payments-ios-sdk-flow","__idx":1},"children":["Overview of Embedded Payments iOS SDK Flow"]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ios-embedded-payments-flow.32c9f061849f7bdb357ce4af4de5282d453963e0950d434116ec54823250e711.7fb3124b.png","alt":"iOS Embedded Payments Flow"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"integration","__idx":2},"children":["Integration"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"embedded-payments-connection-endpoint","__idx":3},"children":["Embedded Payments connection endpoint"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before the SDK can be used, implement the Embedded Payments connection endpoint."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"your-server","__idx":4},"children":["Your Server"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"expose-an-endpoint-on-your-server","__idx":5},"children":["Expose an endpoint on your server"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When your iOS App is first initialised, a request is sent to your server to establish a Tyro Embedded Payments connection. This is required to connect to the Embedded Payments reader. Upon receiving the client request, authenticate your user and send the request to Tyro with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["readerId"]}," in the request body (obtained from ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/account-authorisation"},"children":["Account Authorisation"]},". The Embedded Payments connection response will return a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]},", this should be returned to your App."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"// Node sample code\nconst express = require(\"express\");\nconst app = express();\nconst axios = require('axios');\n\n...\n\napp.post(\"/create-connection\", async (req, res) => {\n  const { userIdOrDeviceId } = req.body; // You can associate a user or device to the reader.\n  // You will manage the authentication between your server and App.\n\n  const readerId = await this.findReaderIdForUser(userIdOrDeviceId);\n\n  // Create a Embedded Payments connection by providing the location Id\n  const connectionResponse = await axios.post('https://api.tyro.com/connect/tap-to-pay/connections',\n  {\n    \"readerId\": readerId, // e.g. \"f310e43b-a6c9-4c43-9535-ff68b2b9c4a1\"\n  },\n  {\n    headers: {\n    'Content-Type': 'application/json',\n    'Authorization': 'Bearer exampleJwt'\n    }\n  });\n\n  res.send({\n    connectionSecret: connectionResponse.connectionSecret,\n  });\n});\n","lang":"javascript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"in-xcode","__idx":6},"children":["In Xcode"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"install-the-sdk","__idx":7},"children":["Install the SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tyro Embedded Payments SDK for iOS is distributed as a Swift Package via a Github repository."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To add the package dependency to your Xcode project, select File > Add Package Dependency and enter the repository URL: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["https://github.com/tyro/tyro-tap-to-pay-sdk-ios"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also add the package dependency by navigating to your target's General pane > Frameworks, Libraries and Embedded Content section."]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ios-add-swift-package.bb9e9257e2d0a465fff9dc2db6ddc2b32a6773e069e9c7c7a7ff18766955fe20.7fb3124b.png","alt":"iOS Embedded Payments Flow"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app"},"children":["Apple's documentation"]}," for more information about adding package dependencies to your App."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"entitlements","__idx":8},"children":["Entitlements"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In order to facilitate payment, you must request the Embedded Payments on iPhone entitlement from Apple."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Follow ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://developer.apple.com/documentation/proximityreader/setting-up-the-entitlement-for-tap-to-pay-on-iphone"},"children":["Apple's documentation"]}," to obtain the entitlement."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configuration-file","__idx":9},"children":["Configuration File"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add the Tyro provided environment config ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/tyro/tyro-tap-to-pay-sdk-ios/blob/master/SampleApp/SampleApp/Supporting%20Files/config_uat.env"},"children":["config_uat.env"]}," file to your project's Supporting Files sub-directory and add keys to the project ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Info.plist"]}," file."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"xml","header":{"controls":{"copy":{}}},"source":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>ACCESS_KEY</key>\n\t<string>$(ACCESS_KEY)</string>\n\t<key>APPLICATION_ENV</key>\n\t<string>$(APPLICATION_ENV)</string>\n\t<key>ATTESTATION_CERT_PINNING</key>\n\t<string>$(ATTESTATION_CERT_PINNING)</string>\n\t<key>ATTESTATION_HOST</key>\n\t<string>$(ATTESTATION_HOST)</string>\n\t<key>ATTESTATION_REFRESH_INTERVAL</key>\n\t<string>${ATTESTATION_REFRESH_INTERVAL}</string>\n\t<key>KEYLOADING_CA_CERT</key>\n\t<string>$(KEYLOADING_CA_CERT)</string>\n\t<key>KEYLOADING_HOST</key>\n\t<string>$(KEYLOADING_HOST)</string>\n\t<key>KEYLOADING_HOST_CERT_PINNING</key>\n\t<string>$(KEYLOADING_HOST_CERT_PINNING)</string>\n\t<key>SECRET_KEY</key>\n\t<string>$(SECRET_KEY)</string>\n</dict>\n</plist>\n","lang":"xml"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-instance-of-tyrotaptopay","__idx":10},"children":["Create instance of TyroTapToPay"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initialise an instance of the TyroTapToPay class. Pass in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/tyro-environment"},"children":["TyroEnvironment"]}," and your own implementation of the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/connection-provider"},"children":["ConnectionProvider"]}," protocol."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the environment, two environments are available: sandbox and prod. There are limits to using the sandbox environment, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/testing"},"children":["Sandbox Testing"]}," for more details."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the connection provider, you must implement the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ConnectionProvider"]}," protocol. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/connection-provider"},"children":["ConnectionProvider"]}," for more information."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let tyroTapToPaySdk = try TyroTapToPay(\n  environment: .prod,\n  connectionProvider: connectionProvider\n)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"connect-to-the-reader","__idx":11},"children":["Connect to the reader"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After initialising the instance, call the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connect()"]}," function to begin connecting with the reader on the device. This also communicates with your server to fetch the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["connectionSecret"]}," based on the ConnectionProvider that was passed into the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TyroTapToPay"]}," class when initialised. This step is necessary in order to take payments."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"try await tyroTapToPaySdk.connect()\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"reader-update-events","__idx":12},"children":["Reader update events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["readerUpdatePublisher"]}," is a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PassthroughSubject"]}," exposed by TyroTapToPay to communicate information about the state of the reader on the device. It acts as a UI delegate that signals any changes or updates to the reader."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Ensure you are subscribing to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["readerUpdatePublisher"]}," early in the application lifecycle to capture all events. This is useful for notifying the user of the status of the reader, especially when connecting to the reader."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"import Combine\n\nclass ViewModel: ObservableObject {\n  private var cancellables = Set<AnyCancellable>()\n\n  ...\n\n  init() {\n    tyroTapToPaySdk.readerUpdatePublisher\n      .sink { event in\n        switch event {\n        case .updateStarted:\n          print(\"Reader update started\")\n        case .updateInProgress(let progress):\n          print(\"Updating reader: \\(progress)%\")\n        case .updateCompleted:\n          print(\"Reader update complete\")\n        case .updateFailed(let error):\n          print(\"ERROR: Reader update failed: \\(error)\")\n        @unknown default:\n          print(\"Unknown reader update event: \\(event)\")\n        }\n      }\n      .store(in: &cancellables)\n  }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/reader-update-publisher"},"children":["Reader Update Publisher"]}," for more information about the reader update events."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"account-linking-and-apple-terms-and-conditions","__idx":13},"children":["Account linking and Apple Terms and Conditions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Users are presented with Apple’s Embedded Payments on iPhone Terms and Conditions the first time they connect to the reader. This process is automatically handled by Tyro."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You must use a valid Apple ID for your company accepting the terms presented by Apple."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you are connecting to a test environment, you must use a Sandbox Apple ID to accept the terms. You only need to perform this once per company account."]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/apple_tnc1.0a47ebe70d147fd01d28bd42ee472204f808281783ee1639030352430debab67.7fb3124b.png","alt":"Account linking and Apple Terms and Conditions 1"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/apple_tnc2.af3ef83bc6597a6ff0d4bca1c02a042fabb4e4e2c0a145815d82ab47efc97928.7fb3124b.png","alt":"Account linking and Apple Terms and Conditions 2"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/apple_tnc3.19b9d9fec00edd3d5c308212767b4560b582a17666c07131216f5c566be0570f.7fb3124b.png","alt":"Account linking and Apple Terms and Conditions 3"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"making-payments","__idx":14},"children":["Making Payments"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once the Embedded Payments reader is connected you are ready to take payments."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-posinformation","__idx":15},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PosInformation"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Before starting the payment, create an instance of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PosInformation"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let posInformation = POSInformation(name: \"Sample POS\",\n                                    vendor: \"Vendor\",\n                                    version: \"0.1.0\",\n                                    siteReference: \"Sydney\")\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/pos-information"},"children":["PosInformation"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"create-a-transactiondetail","__idx":16},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionDetail"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To start a transaction, create a new ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionDetail"]}," as soon as the amount is known during your checkout flow."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The amount is in cents."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\nclass PaymentViewController: UIViewController {\n  ...\n  func startCheckout(orderId: String) -> TyroTapToPaySDK.TransactionDetail {\n    let transactionDetail = TyroTapToPaySDK.TransactionDetail(\n      amount: \"1000\", // $10.00\n      referenceNumber: \"unique-reference-number\",\n      posInformation: posInformation  // Created in the previous step\n    )\n    ...\n  }\n  ...\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/transaction-detail"},"children":["TransactionDetail"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"take-the-payment","__idx":17},"children":["Take the payment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initiate a payment by invoking ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startPayment(transactionDetail)"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"try await tapToPaySdk.startPayment(transactionDetail: transactionDetail)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"implement-tyro-settings","__idx":18},"children":["Implement Tyro Settings"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your POS application must provide a button for administrators to access Tyro settings. This is required to set the mandatory refund password."," ","Add a button which renders the SwiftUI ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TyroSettingsView"]}," upon click."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"TyroSettingsView()\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"refund-a-payment","__idx":19},"children":["Refund a payment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To refund a payment, invoke the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["refundPayment(transactionDetail)"]}," function."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"try await tapToPaySdk.refundPayment(transactionDetail: transactionDetail)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Tyro will display the Embedded Payments screen and prompt the customer to tap the screen. Once the customer has made the payment, it will automatically be processed through Tyro."]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ttpoi_payment1.9f2479fec2d1ee86d251736c9cfca09de3bc5fd2af93af21d42e9c16c081e67f.7fb3124b.png","alt":"Taking Payment Tap Screeny"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{"style":{"textAlign":"center"}},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ttpoi_payment2.4ab048ec5210988ac401e85c49f378d6de42754b63d25d0ed147d2b546d1dc4b.7fb3124b.png","alt":"Taking Payment Processing Screen"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The payment result will be returned in the response in a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionOutcome"]},". Save the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionID"]}," to your server as it is used to reference the payment. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/transaction-outcome"},"children":["TransactionOutcome"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Display the payment result in your app."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An error will be thrown if the payment was unsuccessful."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\nclass PaymentViewController: UIViewController {\n  ...\n  fun startPayment(paymentRequest: PaymentRequest) async {\n    do {\n      let paymentResult = try await TyroTapToPay.shared.startPayment(paymentRequest)\n\n      var outcomeMsg = \"Status :: \" + paymentResult.statusCode + \" - \" +\n      paymentResult.statusMessage + \"\\n\"\n      outcomeMsg += \"Amount auth :: \" + paymentResult.amount + \"\\n\"\n      outcomeMsg += \"Transaction ID :: \" + paymentResult.transactionID + \"\\n\"\n      outcomeMsg += \"Transaction date :: \" + paymentResult.transactionDate + \"\\n\"\n      outcomeMsg += \"Transaction time :: \" + paymentResult.transactionTime + \"\\n\"\n      outcomeMsg += \"Approval code :: \" + paymentResult.approvalCode + \"\\n\"\n      outcomeMsg += \"Card type :: \" + paymentResult.cardType + \"\\n\"\n      outcomeMsg += \"Elided PAN :: \" + paymentResult.elidedPan + \"\\n\"\n      outcomeMsg += \"Retrieval reference number :: \" + paymentResult.retrievalReferenceNumber + \"\\n\"\n      outcomeMsg += \"Transaction reference :: \" + paymentResult.transactionReference + \"\\n\"\n      // Display success to user\n      print(outcomeMsg)\n    } catch {\n      // Display error to user\n      print(\"Transaction failed.(\" + error!.code + \":\" + error!.message + \")\")\n    }\n    ...\n  }\n  ...\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/start-payment"},"children":["Start payment"]}," for more information."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"scene-changes","__idx":20},"children":["Scene changes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You must also notify the SDK of scene changes by invoking ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tapToPaySdk.didChange(scenePhase: ScenePhase)"]}," function when the application enters the foreground or background."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This modifier should be added to the main ContentView of the application."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"var body: some View {\n  ContentView()\n    .onChange(of: scenePhase) { (_, newValue) in\n      Task.detached {\n        await tapToPaySdk.didChange(scenePhase: newValue)\n      }\n    }\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/sdk/scene-changes"},"children":["Scene Changes"]}," for more information."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sample-app","__idx":21},"children":["Sample App"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A Sample Xcode app is provided in the Github iOS SDK repository, it can be found ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/tyro/tyro-tap-to-pay-sdk-ios/tree/master/SampleApp"},"children":["here"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you wish to run the Sample App, you must update the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["readerId"]}," in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/tyro/tyro-tap-to-pay-sdk-ios/blob/master/SampleApp/SampleApp/POS/SandboxConnectionProvider.swift"},"children":["SandboxConnectionProvider"]}," file with the reader id you have been provided during onboarding."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"register-webhooks","__idx":22},"children":["Register Webhooks"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"handle-webhook-events","__idx":23},"children":["Handle webhook events"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/api-explorer/tap-to-pay/1.0/notification-events"},"children":["Webhook events"]}," are sent once a payment has occurred. Your server should listen to these vents and handle them as required, such as sending a payment receipt email."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"need-help","__idx":24},"children":["Need help?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you have any further questions or need to raise a support request, please use our new ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://tyropayments.atlassian.net/servicedesk/customer/portal/149"},"children":["Integration Support Portal"]}]}]},"headings":[{"value":"Integrate SDK","id":"integrate-sdk","depth":1},{"value":"Overview of Embedded Payments iOS SDK Flow","id":"overview-of-embedded-payments-ios-sdk-flow","depth":2},{"value":"Integration","id":"integration","depth":1},{"value":"Embedded Payments connection endpoint","id":"embedded-payments-connection-endpoint","depth":2},{"value":"Your Server","id":"your-server","depth":3},{"value":"Expose an endpoint on your server","id":"expose-an-endpoint-on-your-server","depth":4},{"value":"In Xcode","id":"in-xcode","depth":2},{"value":"Install the SDK","id":"install-the-sdk","depth":3},{"value":"Entitlements","id":"entitlements","depth":3},{"value":"Configuration File","id":"configuration-file","depth":3},{"value":"Create instance of TyroTapToPay","id":"create-instance-of-tyrotaptopay","depth":3},{"value":"Connect to the reader","id":"connect-to-the-reader","depth":3},{"value":"Reader update events","id":"reader-update-events","depth":3},{"value":"Account linking and Apple Terms and Conditions","id":"account-linking-and-apple-terms-and-conditions","depth":3},{"value":"Making Payments","id":"making-payments","depth":3},{"value":"Create a PosInformation","id":"create-a-posinformation","depth":4},{"value":"Create a TransactionDetail","id":"create-a-transactiondetail","depth":4},{"value":"Take the payment","id":"take-the-payment","depth":4},{"value":"Implement Tyro Settings","id":"implement-tyro-settings","depth":4},{"value":"Refund a payment","id":"refund-a-payment","depth":4},{"value":"Scene changes","id":"scene-changes","depth":4},{"value":"Sample App","id":"sample-app","depth":3},{"value":"Register Webhooks","id":"register-webhooks","depth":2},{"value":"Handle webhook events","id":"handle-webhook-events","depth":3},{"value":"Need help?","id":"need-help","depth":2}],"frontmatter":{"title":"Integrate SDK","seo":{"title":"Integrate SDK"}},"lastModified":"2026-09-10T06:51:58.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/in-person-payments/tap-to-pay/ios/integrate-sdk","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}