DocsAPI Reference
Log In
Docs

Recommended White Label Flow

If you are building a UI for your users to buy / sell / transfer crypto using Meld's APIs, here is the recommended flow to show your users. As example of this flow can be seen at meldcrypto. Your end flow will likely look something like this:

  1. Country: Get the user's location (country) from their device or browser. Meld recommends also letting the user override the default choice and choose the country if they want, because the country should be based on the user's billing address. By letting a user choose their country, a US resident on vacation in Mexico will be able to buy crypto from an onramp that supports the US. To populate the list of supported countries, call Meld's /service-providers/properties/countries?accountFilter=true. This will return a list of countries the onramps you have configured support, along with their display names and flags. For speed and to save resources, Meld recommends caching this response and updating it once a week.
  2. Fiat Currency: Get the list of fiat currencies supported in the user's country by calling /service-providers/properties/fiat-currencies?accountFilter=true&countries=XX where XX is the country code. This response will also include the display name and symbol for each currency. Prepopulate the user's fiat currency based on their country but you can also choose to let the user override the selection if you want. Meld highly recommends allowing your users to make transactions in their local currency: locking your users to just USD for example will lower limits, lower conversion, lower coverage, and will overall be a worse experience for your users. Meld does return the total amount as well as all the fees in USD (as well as the fiat currency used in the transaction).
    1. To prepopulate the user's fiat currency based on their country code, you can any use one of a number of online mappings, or use the one shown here.
  3. Purchase Limits: Get the purchase limits allowed by the onramps you have configured by calling /service-providers/limits/fiat-currency-purchases?accountFilter=true. This will allow you to throw errors in your UI if the users picks a number too high or too low to transaction with.
  4. Token: Get the list of crypto currencies supported by calling /service-providers/properties/crypto-currencies?accountFilter=true&countries=XX where XX is the country code. This response will also include the display name, network, and symbol for each token.
  5. Payment Method: Get the list of payment methods supported by your onramp by calling /service-providers/properties/payment-methods?accountFilter=true. You can choose a default payment method for each provider if you would like (with card being recommended since it has the highest coverage) or let your users select. The payment method field is optional, you can also choose not to pass one in to Meld, then the user's will default to the provider's default in the widget but will be able to change their selection.
  6. Quotes: Once the user has provided all the above information, get a list of quotes by calling /payments/crypto/quote with all the data collected above. Show your users the quotes returned, preferably ranking them by either customerScore or the destinationAmount, which is the amount of crypto the user will receive.
    1. If you would like to show each provider's logo next to their quote, you can get this by calling /service-providers?accountFilter=true. Meld recommends caching this call and updating it once a week at most since this data rarely changes.
  7. Widget: Once the user selects which quote they would like to proceed with. Get the link to the widget for the onramp by calling /crypto/session/widget. DO NOT pre-call the widget endpoint before the user selects which onramp they would like to use!
  8. Transaction Data: Once you receive webhooks informing you of a transaction creation or update, fetch the transaction details by calling /payments/transactions/{id}.

Using the above flow will give you the highest conversion for your users buying crypto. If you would like to skip or modify any of the steps, discuss it with Meld.

Caching Data

Meld recommends caching certain data on your side to reduce load latency and save resources. While certain calls, such as the quote and widget calls, have to be made live because the response changes each time, a lot of the /service-providers/properties calls do not change often because the underlying supported data is updated once a week. Therefore, for those calls, if you aren't passing in any user specific params, Meld recommends caching those responses and refreshing them once a week.