# Refund Payment

Before refunds can be accessed, your POS administrators must first set a refund password. Please see [TyroSettingsView](/pos/embedded-payments/iphone/sdk/tyro-settings-view) for more details.

## tapToPaySdk.refundPayment(transactionDetail: TransactionDetail) async throws

Create a `TransactionDetail` and invoke `tapToPaySdk.refundPayment()` function to initiate a refund.

Transaction results will be returned in a `TransactionOutcome` object.


```swift
public func refundPayment(transactionDetail: TyroTapToPaySDK.TransactionDetail) async throws -> TyroTapToPaySDK.TransactionOutcome
```

See [TransactionDetail](/pos/embedded-payments/iphone/sdk/transaction-detail).

### Parameters


```json
{
  "type": "object",
  "properties": {
    "transactionDetail": {
      "type": "TransactionDetail",
      "description": "The request parameters for the transaction"
    }
  },
  "required": [
    "transactionDetail"
  ]
}
```

### Returns

Returns a `TransactionOutcome` containing detailed information about the result of the refund transaction.

See [TransactionOutcome](/pos/embedded-payments/iphone/sdk/transaction-outcome).

### Throws

It is strongly recommended to handle errors thrown by `tapToPaySDK.refundPayment()` otherwise your App will crash.

#### TapToPaySDKError.transactionError(errorMessage: String)

Throws `TapToPaySDKError.transactionError` when there was an issue with the transaction.

See [TapToPaySDKError](/pos/embedded-payments/iphone/sdk/errors) for more details on errors thrown.