How the sell flow works
- User input — Amount of crypto to sell, desired fiat currency, payout method.
- Quote comparison — Multiple provider quotes with rates and fees.
- Provider selection — User chooses the best quote.
- KYC / KYB — The user must prove their identity, once per offramp. In the Ramp flow this is via the offramp’s UI; in the Virtual Account flow this is manually processed by Meld for the time being.
- Crypto transfer — User sends crypto to the offramp’s wallet.
- Fiat payout — Provider sends fiat to the user’s bank account or card.
Steps to users selling crypto
If you are using your own UI to collect this information, use Meld’s service provider endpoints to know which countries, payment methods, fiat currencies, and tokens the offramps you have enabled support. Once you have the above information, there are two possible flows, depending on what the offramp supports.Standard flow
Complete the following steps, in order:- Get a crypto quote from Meld for each provider. This involves gathering the parameters for the kind of quote the user wants and passing them to the crypto quote endpoint. Meld recommends sorting by the highest
destinationAmount(the amount of fiat the user will receive). - The user selects an offramp based on the quotes (or you select one for them) and launches the offramp’s widget. The user completes the transaction in the widget. This entails the user sending crypto to the offramp and the offramp sending fiat to the payment method they provided (typically bank account or card). You can pass in a
redirectUrlso the user gets redirected after they submit a transaction on the offramp. - Wait and listen for webhooks, and use them as triggers to fetch transaction data. For more information see Fetch transaction information. Once you have transaction data, you can choose how to display it to the user.
Preferred flow
This flow is similar to the one above, but leads to a smoother user experience and therefore higher conversion. Meld recommends using this flow as more offramps start to support it.- Get a crypto quote from Meld for each provider. Meld recommends sorting by the highest
destinationAmount. - The user selects an offramp based on the quotes (or you select one for them) and launches the offramp’s widget. To trigger the preferred flow, pass
"redirectFlow": truein the body of the request (withinsessionData). The user completes KYC and confirms the quote in the widget, but does not complete the transaction there — instead they are redirected back to your UI. - Using the redirect to your UI as a trigger, call Meld’s force fetch transaction endpoint to fetch the token (
sourceCurrencyCode), amount (sourceAmount), and the wallet address for the user to send crypto to (cryptoDetails.destinationWalletAddress). Using these, queue up a transfer of that amount of that token to that wallet address, and ask the user to confirm the transfer. Once they do, commence the transfer. - Once the offramp receives the token, they send fiat to the payment method the user provided (typically bank account or card). You can show the user a transaction status page while they wait for the transaction to complete.
- Wait and listen for webhooks, and use them as triggers to fetch transaction data from the
/transactionsendpoint. For more information see Fetch transaction information.
In both flows, Step 1 (getting a quote) leads to the best user experience but is not required. You can launch an offramp’s widget without asking for a quote beforehand.
How to sell crypto
Quote
Here is an example call to/quotes when selling cryptocurrency. Passing in serviceProviders is optional.
Request
Response
Unlike the Buy flow, currently no
customerScore values are returned for the Sell flow.Widget
Here is an example of the corresponding call to/widget when selling cryptocurrency. Unlike the Buy call, the wallet address should not be passed here.
Request
Response
Webhooks
Here is a sample of aTRANSACTION_CRYPTO_PENDING webhook, which is the first webhook you will receive for any transaction. See more about the various webhooks here.
Transaction data
Once you call/transactions with a transactionId (the paymentTransactionId in the webhook above), this is a sample response:
The
serviceProviderDetails are directly the fields from the offramp’s own transactions endpoint, so the specific fields and field names vary per offramp.