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

# WebView

> The Virtual Accounts experience must be loaded in a WebView environment that supports all required capabilities for onboarding and account management.

## Requirements

The WebView must be configured with:

* Camera access enabled for photo ID capture and selfie checks
* Cookies enabled to maintain session state
* Local storage enabled
* JavaScript enabled
* Standard browser APIs available

Unsupported or restricted WebView configurations — such as incognito mode, disabled storage, or camera-disabled environments — can prevent your customer from completing onboarding or cause unrecoverable flows.

Verify that your WebView implementation explicitly grants camera permissions and supports persistent storage before launching the Virtual Accounts experience.

Once you generate a [Session URL](/products/retail-va/session-management), you can initialize your WebView for either iOS or Android.

<CodeGroup>
  ```kotlin kotlin theme={null}
  import android.webkit.PermissionRequest
  import android.webkit.WebChromeClient
  import android.webkit.WebView
  import android.webkit.WebViewClient

  fun loadVirtualAccountsSession(webView: WebView, sessionKey: String) {
      webView.settings.apply {
          javaScriptEnabled = true
          domStorageEnabled = true          // localStorage
          allowFileAccess = true
          mediaPlaybackRequiresUserGesture = false
      }

      // Persist cookies across sessions
      android.webkit.CookieManager.getInstance().setAcceptCookie(true)
      android.webkit.CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true)

      webView.webViewClient = WebViewClient()

      // Required to grant camera access for photo ID capture and selfie
      webView.webChromeClient = object : WebChromeClient() {
          override fun onPermissionRequest(request: PermissionRequest) {
              request.grant(request.resources)
          }
      }

      webView.loadUrl("https://va.meridianpay.com?sessionKey=$sessionKey")
  }
  ```

  ```swift swift theme={null}
  import WebKit

  class VirtualAccountsViewController: UIViewController, WKUIDelegate {

      var webView: WKWebView!

      override func loadView() {
          let config = WKWebViewConfiguration()
          config.allowsInlineMediaPlayback = true
          config.mediaTypesRequiringUserActionForPlayback = []

          // Enable camera access for photo ID capture and selfie
          config.preferences.javaScriptEnabled = true
          config.websiteDataStore = WKWebsiteDataStore.default() // persistent cookies & localStorage

          webView = WKWebView(frame: .zero, configuration: config)
          webView.uiDelegate = self
          view = webView
      }

      func loadSession(sessionKey: String) {
          let url = URL(string: "https://va.meridianpay.com?sessionKey=\(sessionKey)")!
          webView.load(URLRequest(url: url))
      }

      // Required to allow camera permission prompts inside the WebView
      func webView(_ webView: WKWebView,
                   requestMediaCapturePermissionFor origin: WKSecurityOrigin,
                   initiatedByFrame frame: WKFrameInfo,
                   type: WKMediaCaptureType,
                   decisionHandler: @escaping (WKPermissionDecision) -> Void) {
          decisionHandler(.grant)
      }
  }
  ```
</CodeGroup>

## User experience

The Meridian UI Session provides two initial experiences at start-up:

### 1. KYC onboarding

When your customer opens the Virtual Accounts experience for the first time, Meridian detects that no approved KYC application exists and presents the onboarding screens. The flow guides them through providing employment and source-of-funds details, uploading a government-issued photo ID, and completing a live selfie check. Once verified, the account opens and your customer can begin transacting.

#### Handling onboarding exceptions

Sometimes, your customer must submit additional documentation to open an account. In this scenario, the application has a status of `EDD_REQUIRED`. You and the Meridian team collect the additional documentation outside of the product flow.

Meridian may reject a virtual account application for the following reasons:

* `BANK_REJECTION` - The bank or banking provider rejected the application. Your customer must reach out to support to resolve the issue.
* `RISK_REJECTION` - Your customer failed Meridian's risk assessment. This can happen for many reasons, so your customer must contact support to resolve the issue.
* `INTERNAL_ERROR` - An unexpected error occurred while processing the application. Your customer may resubmit, but verify whether the account was still created before allowing a new submission.

### 2. Account home

For returning customers with an approved KYC application on record, Meridian routes them directly to the Account Home screen. From here your customer can review their transaction history and initiate new deposits or withdrawals. You do not need to do anything beyond the standard session creation flow.
