# Using Superwall Deep Links

(iOS only) How to use Superwall Deep Links to trigger paywalls or custom in-app behavior.

A Superwall Deep Link is a URL hosted at `https://<subdomain>.superwall.app/app-link/...` that opens your app to trigger a paywall as configured on the Superwall dashboard, or custom in-app behavior via the Superwall delegate.

Prerequisites [#prerequisites]

:::flutter
1. Set up [deep link handling](/docs/sdk/quickstart/in-app-paywall-previews)
:::

2. Create a [Web Checkout app](/docs/web-checkout/web-checkout-creating-an-app), even if you do not plan to charge through Web Checkout, this provisions the `*.superwall.app` domain that powers Superwall Deep Links.

Handling incoming links [#handling-incoming-links]

* Always call `handleDeepLink` first. It returns `true` when the SDK recognizes the URL and plans to take over presentation, or `false` when you should continue routing inside your own app.
* When a recognized link arrives before `Superwall.configure(...)` finishes, the SDK caches it and replays it immediately after configuration completes, so it is safe to forward links during cold launch.
* If the return value is `false`, continue with your normal router—those links are not associated with any Superwall experience.

:::flutter
```dart
Future<void> _handleIncomingLink(Uri uri) async {
  final handled = await Superwall.shared.handleDeepLink(uri);
  if (!handled) {
    _routeInternally(uri);
  }
}

void _listenForLinks() {
  uriLinkStream.listen((uri) {
    if (uri != null) {
      _handleIncomingLink(uri);
    }
  });
}
```
:::

Link formats and campaigns [#link-formats-and-campaigns]

Deep link URLs are hosted at `https://<subdomain>.superwall.app/app-link/...`, you can have anything after the `/app-link/` path, including query parameters. These values will be availble to you in audience filters on the Superwall dashboard, or in the `handleSuperwallDeepLink` delegate method.

:::flutter
```dart
class PaywallDelegate extends SuperwallDelegate {
  @override
  void handleSuperwallDeepLink(
    Uri fullURL,
    List<String> pathComponents,
    Map<String, String> queryParameters,
  ) {
    if (pathComponents.isEmpty) {
      return;
    }

    switch (pathComponents.first) {
      case 'campaign':
        final placementId =
            pathComponents.length > 1 ? pathComponents[1] : null;
        if (placementId != null) {
          _routeToPlacement(placementId, queryParameters);
        }
        break;
      default:
        break;
    }
  }
}
```
:::

Keep your own routing logic in place for non-Superwall URLs and for any additional behaviors you want to stack on top of Superwall's default presentation flow.

Related deep link guides [#related-deep-link-guides]

:::flutter
* [Deep Link Setup](/docs/sdk/quickstart/in-app-paywall-previews) — Configure URL schemes, universal links, and wire `handleDeepLink` into your app so Superwall can respond to incoming links.
* [Handling Deep Links](/docs/sdk/guides/handling-deep-links) — Use `handleDeepLink` with the `deepLink_open` standard placement and dashboard campaign rules to present paywalls from your own deep links, without hardcoding routing logic.
:::