> **Key takeaway:**  ☞   The renaming of "Ledger Live" to "Ledger Wallet" and      "wallet" (in
> the hardware sense) to "signer" is still in progress.      This page may
> contain legacy references that will be updated.

# Provider's LiveApp

As explained in the [Card Integration](../../card) page, you need to modify your LiveApp with some specific adjustments compared to the one found in the Discover section.

Your LiveApp must:

- Use the Ledger's [exchangeSDK](https://github.com/LedgerHQ/exchange-sdk), in addition to the Wallet API.
- Have a modified, slightly more complex, Manifest file.
- Follow specific flow/ux requirements.

## Ledger Exchange Services Kit

To learn how to create (or embed if already existing) your user interface for the card, please follow the [Discover documentation](../../discover/getting-started).

Your LiveApp will interact with , through the [ExchangeSDK](https://github.com/LedgerHQ/exchange-sdk), with the corresponding method.

You will need to set up the SDK with your `providerId` attributed upon request by Ledger.

```js copy
const exchangeSDK = new ExchangeSDK("yourProviderId");
```

### CARD method

This method will need you to provide the following parameters:

- `orderId`: The id coming from your system.
- `fromAccountId`: User's Ledger account id.
- `fromAmount`: Amount that will be sold.
- `customFeeConfig`: Custom fee configuration in case the strategy is of type `CUSTOM`. The key-value object is encoded in URI parameter.

```js copy
exchangeSDK.fund({
  orderId: "123abc",
  fromAccountId: "97f06be9-6fb2-5da3-be71-4e762ed6e115",
  fromAmount: BigNumber,
  type: "card",
  feeStrategy?: `SLOW`, `MEDIUM`, `FAST` or `CUSTOM`,
  customFeeConfig?: { [key: string]: BigNumber }, (optional, required for `CUSTOM` feeStrategy):
});
```

> **Note:** Ledger needs to know how to send referral information through the widget.

## Manifest Permission

Your [LiveApp manifest](../../../../docs/discover/wallet-api/appendix/manifest) should contains at least those permissions request:

```json copy
"permissions": [
  "account.list",
  "currency.list",
  "custom.exchange.start",
  "custom.exchange.complete",
  "custom.exchange.error",
]
```

## Tracking Events

The ExchangeSDK includes tracking capabilities for fund card operations.

### Page View

**Trigger:** Page viewed

| Property | Type   | Required | Description | Example          |
| -------- | ------ | -------- | ----------- | ---------------- |
| `page`   | string | yes      | Page name   | `"introduction"` |

```js copy
exchangeSDK.tracking.trackPage("introduction", {
  some: "param",
});
```

### Event: button\_clicked

**Trigger:** Button clicked

| Property | Type   | Required | Description | Example          |
| -------- | ------ | -------- | ----------- | ---------------- |
| `button` | string | yes      | Button name | `"login"`        |
| `page`   | string | yes      | Page name   | `"introduction"` |
| `flow`   | string | yes      | Flow name   | `"cl_card"`      |

```js copy
exchangeSDK.tracking.trackEvent("button_clicked", {
  button: "login",
  page: "introduction",
  flow: "cl_card",
});
```

### Event: cardorder\_initiated

**Trigger:** Card order initiated

| Property   | Type   | Required | Description                | Example                     |
| ---------- | ------ | -------- | -------------------------- | --------------------------- |
| `cardType` | string | yes      | Type of card being ordered | `"virtual"` or `"physical"` |

```js copy
exchangeSDK.tracking.trackEvent("cardorder_initiated", {
  cardType: "virtual", // or "physical"
});
```

### Event: topup\_initiated

**Trigger:** Top up initiated

| Property       | Type   | Required | Description                      | Example |
| -------------- | ------ | -------- | -------------------------------- | ------- |
| `currencyFrom` | string | yes      | Currency used to fund the top-up | `"GBP"` |

```js copy
exchangeSDK.tracking.trackEvent("topup_initiated", {
  currencyFrom: "GBP",
});
```

### Event: topup\_completed

**Trigger:** Top up completed

| Property       | Type   | Required | Description                      | Example |
| -------------- | ------ | -------- | -------------------------------- | ------- |
| `currencyFrom` | string | yes      | Currency used to fund the top-up | `"GBP"` |

```js copy
exchangeSDK.tracking.trackEvent("topup_completed", {
  currencyFrom: "GBP",
});
```

### Event: withdraw

**Trigger:** Withdraw initiated

| Property       | Type   | Required | Description                               | Example                               |
| -------------- | ------ | -------- | ----------------------------------------- | ------------------------------------- |
| `currencyFrom` | string | yes      | Crypto being withdrawn in LedgerID format | `"ethereum/erc20/usd_tether__erc20_"` |
| `currencyTo`   | string | yes      | Fiat being withdrawn                      | `"GBP"`                               |

```js copy
exchangeSDK.tracking.trackEvent("withdraw", {
  currencyFrom: "ethereum/erc20/usd_tether__erc20_",
  currencyTo: "GBP",
});
```

### Event: delegation\_completed

**Trigger:** On delegation completion

| Property   | Type    | Required | Description              | Example           |
| ---------- | ------- | -------- | ------------------------ | ----------------- |
| `limit`    | boolean | yes      | Whether there is a limit | `true` or `false` |
| `currency` | string  | yes      | Currency for delegation  | `"GBP"`           |

```js copy
exchangeSDK.tracking.trackEvent("delegation_completed", {
  limit: true, // or false
  currency: "GBP",
});
```

## Key Generation for Production and Test Environments

To ensure secure communication, you must generate two sets of keys: one for the production environment and one for the test environment. Follow the steps below to generate these keys:

# Testing with the Development Key

After submitting [your keys](./providers-backend#generate-privatepublic-key) to us and once the CAL team has successfully integrated them, you can proceed to test your integration in .

### Steps to Test in Ledger Wallet

1. Open the **Settings** menu in .
2. Navigate to the **Developer** tab.
3. Locate the setting labeled **Exchange in Test Partner Mode**.
4. Enable this setting to activate the test environment.

![Payload and Payload Signature generation diagram](/exchange/exchange-dev-mode.png)

With this mode enabled, you can verify the functionality of your keys and ensure everything is working as expected in the test environment.
