Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.

Android initialization

Overview

D1Task is the main entry point to D1 SDK. It should be called as soon as the issuer application is launched or at the earliest possible time.

Configure the D1 SDK

1

Create a D1Task instance

D1Task.Builder is used to set a one-time configuration. The values can be retrieved from Thales delivery team.

2

Configure the SDK

After setting up D1Task, the issuer application has to call the D1Task.configure API to initialise the SDK. There are certain parameters that are required to be provided by the issuer application, for example consumerID.

3

Provide configuration parameters

  • If the issuer application enables D1 Card Display or D1 Physical Card services, then the ConfigParams.buildConfigCore(consumerID) parameter is required for D1Task.configure.

  • If the issuer application enables D1 Tokenization or D1 Push services, then the ConfigParams.buildConfigCore(consumerID) and ConfigParams.buildConfigCard(activity, oemPayType, serviceId, visaClientAppId) parameters are required for D1Task.configure, where the serviceId parameter is only required for Samsung Pay and visaClientAppId parameter is only required for the Visa payment network.

  • Since D1 SDK 4.0.0 version, Integrator should not use Debug version of D1 SDK for Release version of application, otherwise D1 SDK will throw ERROR_DEBUG_SDK_USED error.

  • Since D1 SDK 3.2.0 version, activity is not mandatory for ConfigParams.buildConfigCard(activity, oemPayType, serviceId, visaClientAppId), the user should pass the activity parameter when calling the D1PushWallet.addDigitalCardToOEM(cardID, oemType, activity, callback) API.

  • As D1 SDK may need to be initialized in different places (refer to NFC Payment service initialization), issuer application needs to create multiple D1Task instances. Hence, it is recommended to clean the old D1Task instances, and always use the latest instance.

  • consumerID is typically available on the activity level. However, if the issuer application is able to obtain it earlier, the issuer application can call D1Task.configure with the parameter ConfigParams.buildConfigCore(consumerID) once consumerID is ready.

  • Android issuer application must use the D1PushWallet API if it supports multiple xPay Wallets such as Samsung Pay and Google Pay.

  • For the Visa payment network, Visa Client App ID is required in the buildConfigCard parameter. This value must be the same as defined in the Visa portal.

Examples

Single feature initialization (Java)
// Ask Thales delivery team for the following information
String d1ServiceUrl = "https://www.123.com";
String issuerID = "IssuerID";
byte[] rsaExponent = new byte[]{};
byte[] rsaModulus = new byte[]{};
String digitalCardUrl = "https://www.456.com";
Context applicationContext = null; // Issuer application should assign the application context.

// Initialize all necessary settings for D1 SDK.
D1Task d1Task = new D1Task.Builder()
        .setContext(applicationContext)
        .setD1ServiceURL(d1ServiceUrl)
        .setIssuerID(issuerID)
        .setD1ServiceRSAExponent(rsaExponent)
        .setD1ServiceRSAModulus(rsaModulus)
        .setDigitalCardURL(digitalCardUrl)
        .build();

// Initialize the required SDKs.
// Application is required to provide consumerId.
String consumerID = "consumerID";
D1Params coreConfig = ConfigParams.buildConfigCore(consumerID);

// Required for Card Processing & Wallet Pay
// Since D1 SDK 3.2.0 version, the first parameter activity is not mandatory during configuration part, user should assign it when calling D1PushWallet.addDigitalCardToOEM() API, which is used to receive callback. D1Task.handleCardResult
// Third parameter is mandatory for Samsung Pay Service ID (Samsung Pay only).
// Last parameter is Visa Client App ID, if the value is not set, then it is assumed that the value is similar with Issuer ID.
D1Params cardConfig = ConfigParams.buildConfigCard(null, OEMPayType.GOOGLE_PAY, null, "visaClientAppId");

D1Task.ConfigCallback<Void> configCallback = new D1Task.ConfigCallback<Void>() {
    @Override
    public void onSuccess(@Nullable Void ignored) {
        // D1 configuration is successful.
    }

    @Override
    public void onError(@NonNull List<D1Exception> exceptions) {
        // D1 configuration failed, check the exception for more details.
    }
};

d1Task.configure(configCallback, coreConfig, cardConfig);

Wallet-specific requirements

Google Pay

For Google Pay, the Activity.onActivityResult() method must be overridden in order to pass the content back to the SDK for further processing.

Samsung Pay

For Samsung Pay, the Samsung Service ID must be specified in the buildConfigCard parameter. The value must be synchronized with that in the Samsung Developer Portal.

Package Name

D1 SDK uses the com.thalesgroup.gemalto.d1 package. Ensure that the classes under this package are used.

Last updated

Was this helpful?