Provider’s LiveApp
As explained in the Sell Integration page, you need to modify your LiveApp with some particularities compared to the one that can be found in the Discover section.
Your LiveApp must:
- Use the Ledger Exchange Services Kit, in addition to the Ledger Services Kit.
- Respond to specific LiveApp URL parameters in order to adapt to the flow inside Ledger Live.
- 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 sell, please follow the Discover documentation.
Your LiveApp will interact with Ledger Live, through the ExchangeSDK, with the corresponding method.
You will need to set up the SDK with your providerId
attributed upon request by Ledger.
SELL method
This method will need you to provide the following parameters:
quoteId
: The id coming from your system and forwarded to your LiveApp as a query parameter.fromAccountId
: User’s Ledger account id, previously given to the LiveApp as a query parameter.fromAmount
: Amount that will be sold.toFiat
: Fiat currency that the user wants to be paid with using provider id.rate
: The crypto/fiat rate.
exchangeSDK.sell({
quoteId: "123abc",
fromAccountId: "97f06be9-6fb2-5da3-be71-4e762ed6e115",// Ledger Live uuid4 account (can be a BTC account)
fromAmount: new BigNumber(1),
toFiat: "EUR", // provider fiat id
rate: 66564, // crypto/fiat rate [BTC/EUR]
type: "sell"
});
LiveApp URL
The LiveApp needs to respond to a URL with some parameters. LiveApp URLs are used to open your LiveApp with the quote values that the user already entered in Ledger Live.
The LiveApp URL format is already fixed and will depend on the information you provided inside your LiveApp manifest (ex: ledgerlive://discover/sellprovidername
).
accountId
: User’s selected account id, where the crypto he wants to sell is stored.cryptoCurrency
: The crypto currency that the user wants to sell. It will contain the providerId value to identify the crypto.network
: The crypto network for the corresponding currency.fiatCurrency
: The fiat currency that the user wants to be paid with.cryptoAmount
: The crypto amount that the user wants to sell.paymentMethod
: The preferred payment method for the user.mode
:buy
orsell
. In this case always sell. Required you share the same base widget url for both usages.bankResidency
: The bank residency of the user.ledgerTransactionId
: id used by ledger to track transactions and their completion statuses.
Example:
https://sell.provider.widget.com?[accountId]=ua11-…&[cryptoCurrency]=BTC&[fiatCurrency]=EUR&[cryptoAmount]=0.04
Ledger needs to know how to send referral information through the widget.
Manifest Permission
Your LiveApp manifest should contains at least those permissions request:
"permissions": [
"account.list",
"currency.list",
"custom.exchange.start",
"custom.exchange.complete",
]