# iOS SDK

## iOS Webview

### [Overview](https://docs.forter.com/mobile-sdks/ios-webview#overview) Overview

For apps that incorporate hybrid or mobile browsers, Forter offers a webview integration solution. As part of the webview integration, please make sure to also include the Forter JavaScript for webview/browser-based components of your app. The Forter JS snippet code and extensive information can be found in [Front-end Integration](https://docs.forter.com/front-end-integration "Front-end Integration").

This call places the mobileUid in a global JS variable (inside the WKWebView) which is later collected by our JavaScript.

### [WKWebView](https://docs.forter.com/mobile-sdks/ios-webview#wkwebview) WKWebView

After the WKWebView is initialized please execute the following code:

```objectivec
[wkWebview evaluateJavaScript:[FTRWebViewIntegration getJSCodeForEval] completionHandler:NULL];
```

Official developer documentation for iOS WKWebView embedding can be found [here](https://developer.apple.com/documentation/webkit/wkwebview "here")

### [Hybrid Apps with Web Browser Checkout page](https://docs.forter.com/mobile-sdks/ios-webview#hybrid-apps-with-web-browser-checkout-page) Hybrid Apps with Web Browser Checkout page

If your app's checkout page uses a webview, use one of the above webview methods in the SDK.

Make sure that the Forter JavaScript is also located within the HTML of the checkout page so that the relevant behavioral and cyber data can be captured.

#### [Send the ForterToken generated by the JavaScript](https://docs.forter.com/mobile-sdks/ios-webview#send-the-fortertoken-generated-by-the-javascript) Send the ForterToken generated by the JavaScript

When an order is placed on a web-based checkout page (in a Hybrid mobile app) the API request should include the **forterToken** (generated by the Forter JavaScript) connectionInformation object of the API request and **NOT** the mobileUID generated by the Forter SDK.

#### [Use WEB orderType](https://docs.forter.com/mobile-sdks/ios-webview#use-web-ordertype) Use WEB orderType

Additionally, when the API request is made to Forter, the orderType of the request body should have an enum value of "WEB" and **NOT** mobile so that our models understand that the order was placed on a mobile WEB browser and not a native mobile screen.

#### [Example Hybrid Mobile Order Request](https://docs.forter.com/mobile-sdks/ios-webview#example-hybrid-mobile-order-request) Example Hybrid Mobile Order Request

The example below outlines the format for an order that was placed on a hybrid web app with an integrated mobile browser as the checkout page.

Note the orderType and forterTokenCookie values in the request. A forterMobileUID is _not_ included in Webview orders.

```json
{
  "orderType": "WEB",
  "eventTime": 1648651702558,
  "connectionInformation": {
    "customerIP": "12.182.159.90.51072",
    "forterTokenCookie": "30867f63af3542cb97881066f290bd",
    "userAgent": "teststore/21.1211 CFNetwork/1329 Darwin/21.3.0"
  }
}
```
