> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fexco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up the DCC library

> Add the Fexco DCC API library to your Android project and connect it to the DCC Container App.

This guide explains how to add the Fexco DCC API library to your Android payment application and connect it to the DCC Container App. After you complete the setup, your application can call the `IRemoteDCCService` interface to check DCC eligibility, request the cardholder choice screen, and record transaction results.

## Before you start

To complete this setup, you need the following:

* Android 9 or later on the target device. The app has been tested on
  Android versions 9 through 14.
* The DCC Container App installed on the device. Contact Fexco to obtain
  the download.
* The `dccPublicApi` and `dcc-aidl` library files (`.aar` format),
  provided by Fexco on request.

The following four steps add the library files to your project,
configure the dependencies, create the service instance, and initialize the SDK.

**Step 1**

### Add the library files

Copy the `dccPublicApi` and `dcc-aidl` library files provided by Fexco into your project's
`app/libs/` directory. The filenames follow this pattern, where
`X.Y.Z` is the version number on the files you received:

```
dccPublicApi-DCCAPIX.Y.Z-snapshot.aar
dcc-aidl-AIDLX.Y.Z-snapshot.aar
```

**Step 2**

### Configure the `build.gradle` file

In your application module's `build.gradle` file, add both library
files as dependencies. Replace `X.Y.Z` with the version number on
the files you received from Fexco:

```groovy theme={null}
dependencies {
    implementation(files("libs/dccPublicApi-DCCAPIX.Y.Z-snapshot.aar"))
    implementation(files("libs/dcc-aidl-AIDLX.Y.Z-snapshot.aar"))
}
```

**Step 3**

### Create the service instance

In the class that handles your payment flow, create an instance of
`IRemoteDCCServiceImpl` by providing the following:

* Your application context
* The DCC app package name: `com.fexco.pos.dcc.app`
* The service action name: `com.fexco.pos.dcc.app.DccCommunicationService`

```kotlin theme={null}
val dccService = IRemoteDCCServiceImpl(
    this,
    "com.fexco.pos.dcc.app",
    "com.fexco.pos.dcc.app.DccCommunicationService"
)
```

**Step 4**

### Initialize the SDK

In the same class, call `init()` with the DHS base URL before calling
any other method. See [Environments](https://docs.fexco.com/dcc/api-reference/environments.md)
for the correct URL for your environment.

```kotlin theme={null}
dccService.init(
    "YOUR_DHS_BASE_URL",
    object : DccInitCallback {
        override fun onSuccess() {
            // Proceed with getDccOffer() or getDccRate().
        }
        override fun onFailure(error: DccError) {
            // Check the DHS URL and device network connectivity.
        }
    }
)
```

> [!TIP]
>
> `onSuccess` is called when the SDK initializes correctly. If
> `onFailure` is called, check that the DHS base URL is correct for
> your environment and that the device has network connectivity.

When `onSuccess` is called, the DCC library is fully integrated
and initialized. Your payment application can now call
`IRemoteDCCService` methods to check DCC eligibility, request the
cardholder choice screen, and record transaction results. See
[DCC service methods](https://docs.fexco.com/dcc/developer-resources/android-app/iremotedccservice.md)
for the full method reference.

## Next steps

With the library integrated, the following pages will help you build
out the DCC transaction flow.

* [DCC service methods](https://docs.fexco.com/dcc/developer-resources/android-app/iremotedccservice.md):
  reference for all methods available through the `IRemoteDCCService`
  interface.
* [Environments](https://docs.fexco.com/dcc/api-reference/environments.md): base URLs for all
  DCC environments to pass to `init()`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.