> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/merchant-tokenization/visa-ctf-and-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-customer-service.md).

# Activate binding with customer service

Customer service is used as the **ID\&V** method to activate a pending device binding.

This page continues the flow after [Create device binding (yellow flow)](/merchant-tokenization/visa-ctf-and-daf/implement-ctf-and-daf/create-device-binding-yellow-flow.md).

Prerequisites:

* You already started `createBinding` or `resumeBinding`.
* The issuer selected `CUSTOMER_SERVICE` as the ID\&V method.
* Your merchant application can route the end user to customer service.

## Flow

<figure><img src="/files/P3JJCO6e4QN2oGJ4RhIl" alt=""><figcaption><p>Customer service device binding flow.</p></figcaption></figure>

<table><thead><tr><th width="100">Step</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>The end user selects the customer service option in the merchant application.</td></tr><tr><td>2</td><td>The merchant application forwards the selection to the Thales backend.</td></tr><tr><td>3</td><td>The end user contacts the issuer to authenticate and confirm the device binding request.</td></tr><tr><td>4</td><td>The issuer accepts the device binding request and informs <strong>VTS</strong>.</td></tr><tr><td>5–6</td><td>VTS notifies the Thales backend, which notifies the merchant/PSP backend.</td></tr><tr><td>7</td><td>The merchant/PSP backend communicates the result to the merchant application.</td></tr><tr><td>8</td><td>The merchant application activates the binding locally in the Thales SDK.</td></tr></tbody></table>

{% hint style="info" %}
In the customer service flow, the merchant application starts the device binding. The final approval comes from the server side.

Handle potential device/server desynchronization. Only activate the binding locally after you receive a successful status.
{% endhint %}

## SDK integration

### 1. Select the customer service ID\&V method

During `createBinding` or `resumeBinding`, submit `Customer Service` as the ID\&V method.

{% tabs %}
{% tab title="Android" %}
If the submission succeeds, the SDK calls `onIssuerAuthenticationReady`. If it fails, the SDK calls `onError`.

```java
@Override
public void onIssuerAuthenticationRequired(IDVSession idvSession) { 
    // Submit CUSTOMER_SERVICE ID&V Method
    for (IDVMethod idvMethod : idvSession.getIdvMethods()) {
        if (idvMethod.getType().equals(IDVType.CUSTOMER_SERVICE)) {
            idvSession.selectIdvMethod(idvMethod);
        }
    }
}

@Override
public void onIssuerAuthenticationReady(IDVSession idvSession, 
                                        @Nullable OtpActivationStatus status) {
    
}

@Override
public void onError(TMGClientException exception) { 
    // Check if there's any error
    int errorCode = exception.getErrorCode();
    int errorMessage = exception.getMessage();
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
guard let idvSession = VisaService.shared.idvSession else {
    // no idv session
    return
}
// 1. Displays the list of IDV methods
do {
    let idvMethods = try idvSession.idvMethods
    let selectedIdvMethod = idvMethods[0] // user select an CUSTOMER_SERVICE idv method
    
    // 2. Submit the IDV method.
    idvSession.selectIDVMethod(selectedIdvMethod) { (result) in
        if let otpActivationStatus = result {
        
        } else {
            if selectedIdvMethod.type == .customerService {
                let value = selectedIdvMethod.value
                // 3. Verify through customer service.
            }
        }
    }
} catch let error {
    // Handles the error.
}

// 4. Failure in step 2, selectIDVMethod, will be handled in completionHandler.
VisaService.shared.completionHandler = { (session, error) in
    // 5. Check if it is a selectIDVMethod error.
    if let session = session,
        let error = error,
        error.description == TMGError.invalidIdvMethod.description {
        VisaService.shared.idvSession = session
        // 6. Retry the IDV flow.
    }
}
```

{% endtab %}
{% endtabs %}

### 2. Get customer service data

Use the `IDVMethod.value` to display the customer service information returned by the issuer.

{% tabs %}
{% tab title="Android" %}
The data that is needed for token activation can be retrieved from the `IDVMethod` object.

```java
// Get the customer service data
String value = idvMethod.getValue();
```

{% endtab %}

{% tab title="iOS" %}

```swift
let value = selectedIdvMethod.value
```

{% endtab %}
{% endtabs %}

### 3. Activate the binding

After you receive a successful confirmation, activate the binding by calling `activateBinding` on the `IDVSession`.

Pass `null` (Android) or `nil` (iOS) to confirm that customer service verification is complete.

{% tabs %}
{% tab title="Android" %}

```java
@Override
public void onIssuerAuthenticationReady(IDVSession idvSession, 
                                        @Nullable OtpActivationStatus status) { 
    // Activate binding locally
    idvSession.activateBinding(null);
}

@Override
public void onError(TMGClientException exception) { 
    // Check if there's any error
    int errorCode = exception.getErrorCode();
    int errorMessage = exception.getMessage();
}
```

The result is returned via `onSuccess` or `onError`.
{% endtab %}

{% tab title="iOS" %}

```swift
guard let idvSession = VisaService.shared.idvSession else {
    // no idv session
    return
}
// 1. Call activate
idvSession.activateBinding(withValue: nil)

VisaService.shared.completionHandler = { (session, error) in
    // 2. Binding successful
    if error == nil {
        
    }
}
```

The result is returned in `completionHandler`.

If activation fails, `completionHandler` returns an `IDVSession` and an error for retry.
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/merchant-tokenization/visa-ctf-and-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-customer-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
