> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle redirects & deep links

Handling redirects is required for Payment Methods that present a webpage for the customer to enter their credentials and validate their payment.

When the user selects such a Payment Method, Universal Checkout will show the webpage in a web view, and then return to the merchant app. This optionally triggers a deep link, opening `urlScheme`, passed to `PrimerSettings` (via `PrimerPaymentMethodOptions`)

This however does not work properly in the following scenario:

* The Payment Method opens a third-party banking app like *Revolut* through deep linking

## Set up redirects

Add the following to your `AppDelegate.swift` or `SceneDelegate.swift`

```swift SWIFT theme={"dark"}
import PrimerSDK
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  // ...
  func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
      Primer.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
  }

   func application( _ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
      Primer.shared.application(app, open: url, options: options)
    }
}
```
