Setting up CardinalMobileSDK - Android

Step 1 - Update the Gradle Build Properties to Integrate Cardinal Mobile SDK

In Android Studio, open the app directory (which can also be labeled Module: app) and then open the build.gradle file. Double-check to make sure that you edit the Gradle file that is located in the app directory. Add the following contents to the Gradle file.

repositories { ... maven { url "https://cardinalcommerceprod.jfrog.io/artifactory/android" credentials { username '' // Artifactory username password '' // Artifactory API Key } } } dependencies { ... //Cardinal Mobile SDK implementation 'org.jfrog.cardinalcommerce.gradle:cardinalmobilesdk:2.2.6-1' }

If your project uses Proguard, add the following lines into proguard-rules.pro file:

-keep class com.cardinalcommerce.dependencies.internal.bouncycastle.** -keep class com.cardinalcommerce.dependencies.internal.nimbusds.**

 

If you do not already have a Username and API Key for the JFrog Platform, please reach out to your CardinalCommerce Solution Engineer or account manager.

Step 2 - Configure Cardinal Mobile SDK

Upon successfully completing Integration in Step 1, get the instance of the cardinal object by Cardinal.getInstance(). SDK offers multiple configuration options for you (if not specified, everything is set to default). For more details see the Configurations table further down in this article. Use the code snippets below for completing the cardinal.configure()

Java

private Cardinal cardinal = Cardinal.getInstance(); @Override protected void onCreate(Bundle savedInstanceState) { CardinalConfigurationParameters cardinalConfigurationParameters = new CardinalConfigurationParameters(); cardinalConfigurationParameters.setEnvironment(CardinalEnvironment.STAGING); cardinalConfigurationParameters.setRequestTimeout(8000); cardinalConfigurationParameters.setChallengeTimeout(5); JSONArray rType = new JSONArray(); rType.put(CardinalRenderType.OTP); rType.put(CardinalRenderType.SINGLE_SELECT); rType.put(CardinalRenderType.MULTI_SELECT); rType.put(CardinalRenderType.OOB); rType.put(CardinalRenderType.HTML); cardinalConfigurationParameters.setRenderType(rType); cardinalConfigurationParameters.setUiType(CardinalUiType.BOTH); cardinalConfigurationParameters.setLocationDataConsentGiven(true); UiCustomization yourUICustomizationObject = new UiCustomization(); cardinalConfigurationParameters.setUICustomization(yourUICustomizationObject); cardinal.configure(this,cardinalConfigurationParameters); }

Kotlin

 

Security Guide

After you configure cardinalSession, call method getWarnings to get the list of all the warnings for the particular device. Take further action based on the warnings found. The list of warnings can be accessed as follows:

List<Warning> warnings = cardinal.getWarnings();

See our Android Security Guidance for more details.



Available Configurations  

Method

Description

Default Values

Possible Values

Method

Description

Default Values

Possible Values

setEnvironment(CardinalEnvironment environment)

Sets the environment the SDK has to connect to

CardinalEnvironment.PRODUCTION

  • CardinalEnvironment.PRODUCTION

  • CardinalEnvironment.STAGING

setUiType(CardinalUiType uiType)

Sets all UI types that the device supports for displaying specific challenge user interfaces within the SDK. This setting interacts with renderType in important ways. See setRenderType(org.json.JSONArray renderType) below for more information.

CardinalUiType.BOTH

It is recommended that you use CardinalUiType.BOTH to ensure your SDK integration can accept and render both the Native and HTML render types an issuer may use. Deviating from this default value could result in impacts to overall SDK transaction performance.

  • CardinalUiType.BOTH

  • CardinalUiType.Native

  • CardinalUiType.HTML

setRenderType(org.json.JSONArray renderType)

Sets render Lists all UI types that the device supports for displaying specific challenge user interfaces within the SDK.

Note:

  • When using CardinalUiType.BOTH or CardinalUiType.HTML, all renderType options must be set.

  • When using CardinalUiType.Native, all renderType options except CardinalRenderType.HTML must be set.

See setUiType(CardinalUiType uiType) above for more information on which uiType to use.

 



  • CardinalRenderType.OTP

  • CardinalRenderType.SINGLE_SELECT

  • CardinalRenderType.MULTI_SELECT

  • CardinalRenderType.OOB

  • CardinalRenderType.HTML

  • CardinalRenderType.OTP

  • CardinalRenderType.SINGLE_SELECT

  • CardinalRenderType.MULTI_SELECT

  • CardinalRenderType.OOB

  • CardinalRenderType.HTML

setProxyAddress(java.lang.String proxyAddress)

Sets the proxy the SDK has to connect to

"" (empty string)

String Value

setRequestTimeout(int requestTimeout)

Sets the maximum amount of time (milliseconds) for all exchanges

8000

>=0 Milliseconds (Integer)

setChallengeTimeout(int challengeTimeout)

Sets the maximum amount of time (minutes) for challenge

5

>=5 minutes (Integer)

setUICustomization(UiCustomization UI Customization)

Sets UICustomization      

Device Default Values

See article: Challenge User Interface Customization Android

setEnableDFSync(boolean enableDFSync)

On setting true, onSetupCompleted in step 4, will be called after device data collected is sent to the server

true

Boolean

setThreeDSRequestorAppURL(String threeDSRequestorAppURL)

The setThreeDSRequestorAppURL method may set the 3DS Requestor App URL. If the app sets the URL, then the SDK shall pass the URL to the server.

"" (empty string)

String Value

setEnableLogging(boolean enableEventLogging)

Enable cardinal logging

true

Boolean

setLocationDataConsentGiven()

Validates if the app has received consent to collect location data.

false

Boolean

setEnableQuickAuth(boolean enableQuickAuth)  (Deprecated )

Sets enable quick auth

true

Boolean