Skip to main content

Integration with Cybersource

The following steps should only be followed if you have requested activation of Cybersource's fraud detection functionality through Izipay. Otherwise, following these steps will only increase the size of the application without any advantage. On the contrary, if you have requested the activation of Cybersource's fraud detection functionality, these steps are mandatory, failure to follow them may result in payment denials by cybersource due to lack of data.

Step 1: Library integration

To integrate the Cybersource libraries into your iOS project, follow these technical steps:

  1. Add the 3 Cybersource libraries to the app project. Drag the .xcframework files into the project.
  2. In the commerce settings, in the "General " tab, go to the "Frameworks, Libraries, Embedded content " section (the name of the section may vary depending on the Xcode version).
  3. Change the "Embed" flag of the libraries to "Embed & Sign ".

These steps will ensure that the Cybersource libraries are correctly embedded in your iOS project.

Step 2: Import of dependencies

To integrate the Izipay SDK into the screen from which it is called, add the following lines of code at the top of the driver file:

import IzipayPayButtonSDK
import RLTMXProfiling
import RLTMProfilingConnections

class ViewController: UIViewController {
//...
}

This will ensure that the Izipay SDK is correctly imported into the display driver, allowing you to use its functions and features in that specific context.

Step 3: Configuration of the Profiling variable

Add a global variable to the controller used in the previous step as follows:

var profile : RLTMXProfiling? = RLTMXProfiling.sharedInstance()

By declaring the izipayInstance variable as an instance of IzipaySDK, you will be able to access the functionality provided by the SDK throughout the scope of that driver. This will allow you to use SDK methods and properties as needed in your implementation.

Then, add the following method(function):

private func doProfileRequest(forUser userScoring : String, with id : String) {
let customAttributes : [String : String] = [RLTMXSessionID: "\(userScoring)\(id)"]

if let safeProfile = self.profile {
let _: RLTMXProfileHandle =
safeProfile.profileDevice(profileOptions:customAttributes, callbackBlock:{(result:
[AnyHashable : Any]?) -> Void in
let results:NSDictionary! = result! as NSDictionary
let status:RLTMXStatusCode =
RLTMXStatusCode(rawValue:(results.value(forKey: RLTMXProfileStatus) as!
NSNumber).intValue)!
_ = results.value(forKey: RLTMXSessionID) as! String
if status == RLTMXStatusCode.ok {
// RLTMXStatusCodeOk en lugar de ok en versiones antiguas
// No errors, profiling succeeded!
}
})
}
}

Step 4: Implementation of the executeProfiling method

Finally, add the following code as an implementation of the executeProfiling method:

func executeProfiling(_ params: IzipayPayButtonSDK.ScoringParams) {
let profilingConnections : RLTMXProfilingConnections = RLTMXProfilingConnections.init()
profilingConnections.connectionTimeout = TimeInterval(params.timeout);
profilingConnections.connectionRetryCount = Int32(params.intents);
profile = RLTMXProfiling.sharedInstance()
profile?.configure(configData:[
RLTMXOrgID : params.userOrg ?? "",
RLTMXFingerprintServer : params.defaultServer ?? "",
RLTMXProfileTimeout : profilingConnections.connectionTimeout,
RLTMXProfilingConnectionsInstance: profilingConnections,
])
self.doProfileRequest(forUser: params.userScoring ?? "", with: params.randomFp ?? "")
}