Link Search Menu Expand Document

Obtaining and Installing

Table of contents
  1. Obtaining and Installing
    1. Downloads location
    2. Installing
      1. Android
      2. Browser
      3. iOS
    3. Initializing
      1. Android
      2. Browser
      3. iOS

Downloads location

The most recent version of the Android, iOS and Browser SDKs can be downloaded here

Installing

Android

Below is a routine for getting the Android SDK installed in an application.

  • Place the SDK aar into your application libs directory.
  • Add these lines inside the dependencies in the app’s build.gradle file with the actual SDK aar file name instead uSDK-android-7.x.yy.aar:
dependencies {
    ...
    // The uSDK itself
  implementation(name: 'uSDK-android-7.x.yy', ext: 'aar')
   
   // The uSDK dependencies
  implementation "com.google.android.gms:play-services-location:18.0.0"
  implementation "com.google.android.gms:play-services-ads-identifier:18.0.0"
  implementation "com.android.support:appcompat-v7:28.0.0"
}

Please note that the version of the play-services and appcompat dependencies were actual for the time of writing of this documentation. The actual versions may be different in the future.

Please also make sure that the following permission is listed in the Android manifest file:

<uses-permission android:name="android.permission.INTERNET"/>

The uSDK needs the permission to be able to contact the cAPI / SplitSDK Server at runtime.

You may need to add the libs directory as repository in the app’s build.gradle file if you have not used manual linking before:

repositories {
    flatDir {
        dirs 'libs'
    }
}

Browser

This is how the Browser uSDK is integrated with a merchant web site.

  • Place the downloaded .js file into under a web server
  • Include the .js file in an .html page (use the actual file name downloaded instead of uSDK-browser-7.x.yy.js though)
<script src="/uSDK-browser-7.x.yy.js"></script>

iOS

Once the iOS SDK is downloaded the following steps need to be performed:

  1. Unzip the file downloaded in a temporary folder
  2. Copy the uSDK.framework directory into your project directory
  3. In Xcode, click on your project. Then click on the target you want to link to. Finally, click on Build Phases.
  4. Expand the Link Binary With Libraries section.
  5. Click the +
  6. Then click Add Other and choose Add Files
  7. Navigate to uSDK.framework directory
  8. Click Open

Initializing

The uSDK needs to be initialized before first use. Once initialized, the uSDK is ready to perform its authenticate method. This section shows how to initialize the uSDK.

Android

ThreeDS2Service threeDS2Service = new ShellThreeDS2Service();

InitializeSpec initializeSpec = new InitializeSpec(this /* Activity */);

threeDS2Service.initialize(initializeSpec, new InitializeCallback() {
    @Override
    public void onSuccess() {
        Log.i("APP", "uSDK has been successfully initialized!");
    }

    @Override
    public void onFailure(Exception e) {
        Log.e("APP", "Failed to initialize uSDK!", e);
    }
});

Browser

const usdk = new ShellThreeDS2Service();

const initializeSpec = {};
const initializeCallback = {
    onSuccess: function () {
        console.log('uSDK has been successfully initialized!');
        // now it is possible to call the `authenticate` method on the 'usdk' instance.
    },
    onFailure: function (error) {
        console.log('Failed to initialize uSDK! Error: ', error);
    }
}
usdk.initialize(initializeSpec, initializeCallback);

iOS

class MyViewController: UIViewController {

    @IBOutlet weak var authButton: UIButton!
    private let threeDS2Service: ThreeDS2Service = ShellThreeDS2Service()

    override func viewDidLoad() {
        super.viewDidLoad()

        do {
            try threeDS2Service.initialize(spec: InitializeSpec(), callback: { result in
                switch result {
                case .success:
                    print("uSDK has been successfully initialized!")
                    self.authButton.isEnabled = true
                    break
                case .failure(let error):
                    print("Failed to initialize uSDK: \(error)")
                }
            })
        }
        catch {
            print("Error during initializating uSDK: \(error)")
        }
    }
}