{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Cancellations and Refunds","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":"cancellations-and-refunds","__idx":0},"children":["Cancellations and Refunds"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"refunds","__idx":1},"children":["Refunds"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Refunds can be easily accepted via the Tyro SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"prerequisites","__idx":2},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Please familiarise yourself with the guide to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/ios/integrate-sdk"},"children":["Integrate the SDK"]},", as the steps outlined in this document builds upon the existing integration."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"reader-connection","__idx":3},"children":["Reader Connection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Embedded Payments reader must be connected to process refunds."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-refund-request","__idx":4},"children":["Create a Refund Request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a Refund Request as soon as the refund amount is known."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\nclass RefundViewController: UIViewController {\n  ...\n  fun startRefund(refundId: String) -> PaymentRequest {\n    let refundRequest = TyroTapToPay.shared.createRefundRequest(amountCents: 1000, referenceId: refundId)\n    ...\n  }\n  ...\n}\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"take-the-refund","__idx":5},"children":["Take the Refund"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initiate a refund by invoking ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startRefund(refundRequest)"]},". Tyro will display the Embedded Payments screen and prompt the customer to tap the screen. Once the customer has tapped their card, the refund will automatically be processed through Tyro."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The refund result will be returned in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["startRefund(..)"]}," response. Save the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["transactionID"]}," to your server as it is used to reference the refund."," ","Display the refund result in your app."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An error will be thrown if the refund was unsuccessful."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\nclass RefundViewController: UIViewController {\n  ...\n  fun startRefund(refundRequest: RefundRequest) async {\n    do {\n      let paymentResult = try await TyroTapToPay.shared.startRefund(refundRequest)\n\n      let transactionId = paymentResult.transactionID\n      var outcomeMsg = \"Status :: \" + paymentResult.statusCode + \" - \" +\n      paymentResult.statusMessage + \"\\n\"\n      outcomeMsg += \"Reference ID :: \" + paymentResult.referenceID + \"\\n\"\n      outcomeMsg += \"Amount auth :: \" + paymentResult.amountAuthorized + \"\\n\"\n      outcomeMsg += \"Transaction ID :: \" + paymentResult.transactionID + \"\\n\"\n      outcomeMsg += \"Transaction date :: \" + paymentResult.transactionDate + \"\\n\"\n      outcomeMsg += \"Approval code :: \" + paymentResult.approvalCode + \"\\n\"\n      outcomeMsg += \"Invoice no :: \" + paymentResult.invoiceNo + \"\\n\"\n      outcomeMsg += \"AID :: \" + paymentResult.aid + \"\\n\"\n      outcomeMsg += \"Card type :: \" + paymentResult.cardType + \"\\n\"\n      outcomeMsg += \"Card number :: \" + paymentResult.cardNo + \"\\n\"\n      outcomeMsg += \"RRN :: \" + paymentResult.rrn\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":"Heading","attributes":{"level":2,"id":"cancel-a-transaction","__idx":6},"children":["Cancel a Transaction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The current refund or payment can be cancelled if the cancellation is submitted before the transaction has been fully processed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"attempt-a-cancellation","__idx":7},"children":["Attempt a cancellation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Initiate a cancellation attempt of the current transaction by invoking ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cancelCurrentTransaction()"]},". If the cancellation has succeed, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," is returned, otherwise ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]}," is returned."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"// Swift Sample Code\nclass CancelViewController: UIViewController {\n  ...\n  fun cancelTransaction() {\n    let cancellationResult = TyroTapToPay.shared.cancelCurrentTransaction()\n    if cancellationResult {\n        print(\"Transaction successfully cancelled\")\n    } else {\n        print(\"Cancellation failed\")\n    }\n    ...\n  }\n  ...\n}\n","lang":"swift"},"children":[]}]},"headings":[{"value":"Cancellations and Refunds","id":"cancellations-and-refunds","depth":1},{"value":"Refunds","id":"refunds","depth":2},{"value":"Prerequisites","id":"prerequisites","depth":3},{"value":"Reader Connection","id":"reader-connection","depth":3},{"value":"Create a Refund Request","id":"create-a-refund-request","depth":3},{"value":"Take the Refund","id":"take-the-refund","depth":3},{"value":"Cancel a Transaction","id":"cancel-a-transaction","depth":2},{"value":"Attempt a cancellation","id":"attempt-a-cancellation","depth":3}],"frontmatter":{"title":"Cancellations and Refunds","seo":{"title":"Cancellations and Refunds"}},"lastModified":"2026-09-02T01:02:13.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/in-person-payments/tap-to-pay/ios/cancellations-and-refunds","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}