Buying vs. Selling vs. Transferring Crypto
Buying Crypto
The crypto quote and widget endpoints supports buying (on-ramp) and selling (off-ramp) cryptocurrencies. Simply flip the 2 currencies in the request to change the quote from buy to sell, and vice versa.
Here is an example when buying cryptocurrency:
{
"sourceAmount": "50.01",
"sourceCurrencyCode": "USD",
"destinationCurrencyCode": "BTC"
}Selling Crypto
Here is an example when selling cryptocurrency:
{
"sourceAmount": "0.01",
"sourceCurrencyCode": "BTC",
"destinationCurrencyCode": "USD"
}Transferring Crypto
Transferring cryptocurrency uses the same widget endpoint as buy or sell, but requires explicitly stating the transaction type. Note that for a transfer in your Headers you must setMeld-Version to 2023-12-19 or later. Here is an example of a request body.
{
"sessionData": {
"walletAddress": "testWalletAddress",
"countryCode": "US",
"sourceCurrencyCode": "ETH",
"sourceAmount": "100",
// "institutionId": "WQ4TWHRBuHVSC46yS92L1w",
"serviceProvider": "MESH"
},
"sessionType": "TRANSFER"
}Passing in the institutionId above will skip the picker screen and go straight into the flow for that specific institution. For example the Id in the request above is for Coinbase, so instead of selecting Coinbase from a list of wallets you will go straight to the Coinbase login screen. You can get the institutionId from the /institutions endpoint.
See the API Reference for quotes and widgets for more details on how the requests look.
Updated 2 months ago