Translation disclaimer

Documentation is written in English and subsequently translated. This page, therefore, might not have the most up-to-date content. If any questions arise relating to the accuracy of the translated content, please refer to the English version of the page.

Menu

注释:该 API 仅用于预览用途并会随时更改。

设备数据收集

当与订单和交易详细信息相结合时,设备数据(IP 地址、设备 Id、地理位置信息等)会是欺诈的重要标志,或通过 GeoIP 查找创建基于位置的手动规则。利用具有 Access Exemptions 功能的设备数据需要两个步骤。第一步是收集设备数据。第二步是提交将使用设备数据进行评估的评估。以下所述为 iOS 的第一步。

ThreatMetrix iOS SDK

ThreatMetrix iOS SDK 为手机应用程序开发人员提供了特定于 iOS 的库。它利用 ThreatMetrix 平台实时检测来自移动设备的欺诈和安全漏洞。

此说明适用于 ThreatMetrix SDK V6-2 版本。

实施概述

  1. 将 ThreatMetrix SDK 分析模块加入应用程序中。

  2. 调用 initProfile() 方法,初始化 SDK。

  3. 调用 doProfile() 方法,开始进行设备分析。ThreatMetrix SDK 模块会将收集到的属性和唯一 sessionId 传输到 ThreatMetrix 平台。

  4. 在豁免评估请求中应用 sessionId,使其成为风险评估的一部分。

如何获取 SDK

注释:该产品即将发布,此文档仅供预览

加入的模块

  • TMXProfiling:此模块负责以独有方式执行分析。它不会通过网络传输任何内容,因此模块本身不发送或接收数据。此模块需要与 TMXProfilingConnections 模块或自定义分析连接模块配对,以便向后端发送以及从后端接收数据,进而成功分析。

  • TMXProfilingConnections:它是 ThreatMetrix 提供的默认网络模块。此模块仅通过网络传输数据,而不会更改数据。

下载 TMXProfiling 的 .dmg 文件和 TMXProfilingConnections 模块,然后提取 .xcframework 文件。

将 .xcframework 文件作为依赖项复制到应用程序目录。

使用 ThreatMetrix SDK

分析

分析是 ThreatMetrix 通过网站或本机应用程序收集有关访问客户在线服务的设备信息的机制。

确定本机应用程序中为分析提供最佳机会的屏幕。大多数分析都是在短时间内完成的,收集全套分析属性可能需要 5 秒钟。

我们可以启动分析的常见屏幕为账户创建屏幕、付款屏幕和登录屏幕。

所需的详情

将以下详细信息传至 configure() 方法。

占位符描述
TMXOrgId
  • 对于测试用途:afevfjm6
  • 对于实时用途:dzppsd1h
TMXFingerprintServer/Profiling domain
  • 对于测试用途:ddc-test.worldpay.com
  • 对于实时用途:ddc.worldpay.com

获取实例并初始化

  1. initProfile() 方法内创建 TMXProfiling 实例。
  2. 通过至少以 TMXOrgIdTMXFingerprintServer/Profiling domain 的传送方式调用 configure() 方法。

TMXProfiling 类的 sharedInstance() 方法用于返回 ThreatMetrix 对象的单例实例。该实例只需要初始化一次。

开始分析

创建一个方法 doProfile() 以开始分析,并发送一些附加属性以及分析信息。

以下为示例,说明如何通过创建 initProfile() 和 doProfile() 方法来创建实例和初始化分析。

Copied!
import TMXProfiling
import TMXProfilingConnections
class TmxProfileController : ObservableObject{

    //Get a singleton instance of TMXProfiling
    let profile: TMXProfiling!       = TMXProfiling.sharedInstance()
    var sessionID     : String  = ""

    func initProfile(){

        // The profile.configure method is effective only once and subsequent calls to it will be ignored.
        // Please note that configure may throw NSException if NSDictionary key/value(s) are invalid.
        // This only happen due to programming error, therefore we don't catch the exception to make sure there is no error in our configuration dictionary

            profile.configure(configData:[
                                // (REQUIRED) Organisation ID
                                TMXOrgID              :"afevfjm6",
                                // (REQUIRED) Enhanced fingerprint server
                                TMXFingerprintServer  :"ddc-test.worldpay.com"
                                ])

    }

   func doProfile()
    {

        let customAttributes : [String : Array<String>] = [TMXCustomAttributes: ["attribute 1", "attribute 2"]]

        // Fire off the profiling request.
        // You will be notified of the profiling result in the closure passed in callbackBlock
        let profileHandle: TMXProfileHandle = profile.profileDevice(profileOptions:customAttributes, callbackBlock:{(result: [AnyHashable : Any]?) -> Void in
                let results:NSDictionary! = result! as NSDictionary
                let status:TMXStatusCode  = TMXStatusCode(rawValue:(results.value(forKey: TMXProfileStatus) as! NSNumber).intValue)!

                let statusString: String =
                status == .ok                  ? "OK"                   :
                status == .networkTimeoutError ? "Timed out"            :
                status == .connectionError     ? "Connection Error"     :
                status == .hostNotFoundError   ? "Host Not Found Error" :
                status == .internalError       ? "Internal Error"       :
                status == .interruptedError    ? "Interrupted Error"    :
                "Other"
                print("\nProfile completed with: \(statusString)\nSession ID: \(self.sessionID)")
        })
        // Session id is immediately available on the instance of TMXProfileHandle following to the call to profile.profileDevice()
        self.sessionID = profileHandle.sessionID;
        print("Session equals :- \(self.sessionID)");
    }

}

获取分析结果

使用 TMXStatusCode 获取分析结果,然后使用 profileHandle.sessionId 获取 sessionId。如果分析结果状态返回为 OK,则分析成功。

将设备数据与评估关联

在发送豁免评估请求时,将 sessionId 纳入 deviceData.collectionReference

后续步骤


评估