Overview
The integration process ensures a seamless flow of data between Ledger Live, Ledger Backend, and the provider’s systems. Providers are expected to implement specific endpoints and adhere to the following workflow to support the Sell feature in Ledger Live.
Workflow Diagram
Step 1: Open Sell App
Action: The user opens the Sell App in Ledger Live.
Ledger Live:-
Fetches capabilities data from the Ledger Backend, which caches responses from the provider’s /capabilities endpoint.
-
Fetches supported cryptocurrencies from the Ledger Backend, which caches responses from the provider’s /crypto-currencies endpoint.
Step 2: User Input and Validation
User Interaction: The user selects the cryptocurrency, fiat currency, and the amount they wish to sell.
User Interaction: The user selects their country and preferred payment method (e.g., PayPal, bank transfer).
Validation Process: Ledger Live validates user input. Validation is performed using cached data from /capabilities, ensuring the user’s input aligns with provider-supported limitations (e.g., minimum/maximum amounts, supported countries).
If the input is invalid, Ledger Live displays an error message to the user.
Step 3: Get Quotes and Select Provider
User Interaction: User request quote.
Backend Process: Ledger Backend identifies eligible providers based on the user’s input.
For each eligible provider, the Ledger Backend sends a [GET] /quotes request to the provider backend to retrieve pricing details (e.g., the amount of fiat currency the user will receive after fees).
The provider backend returns quotes, which are aggregated by the Ledger Backend and displayed in Ledger Live.
User Decision: The user selects a provider from the list of quotes.
Step 4: Redirect to Provider Widget
Action: Once a provider is selected, Ledger Live redirects the user to the provider’s widget.
Redirection Details: The redirection includes required parameters as specified in the LiveApp URL documentation, such as the selected cryptocurrency, fiat currency, amount, and user-specific details.
The user lands on the provider widget to complete the transaction details.
Step 5: Initiate Transaction
Provider Widget Interaction: The provider widget initializes the transaction by calling the exchangeSdk.sell
method.
This triggers the Ledger Backend to initiate the transaction.
Backend Process:Ledger Backend sends a [POST] /sell request to the provider backend, requesting a signed payload for the transaction.
The provider backend processes the request and returns the signed payload.
Ledger Backend passes the signed payload to the Exchange SDK.
Device Approval:The Exchange SDK prompts the Ledger device to approve or reject the transaction.
The user approves or rejects the transaction on their Ledger device.
Step 6: Finalizing the Transaction
Post-Approval: After the transaction is approved, the exchangeSDK.sell promise notifies the provider widget about the transaction’s result, including a transactionId if approved. It is the responsibility of the provider widget to inform the provider’s backend of the final transaction status to initiate webhooks if the user has approved the transaction.
If the event the transaction is rejected, the provider is similarly notified.
Real-Time Updates:
The provider backend sends real-time transaction status updates to the Ledger Backend via a [POST] /webhook/status
endpoint.
Ledger Backend updates the transaction status in Ledger Live, ensuring the user is notified of the transaction’s progress and completion.