portal.ramps.meld. Each method sends a message to the embedded Portal iframe, which calls Portal’s Meld integration on the Client API using your client credentials. You do not call Meld’s servers directly from the browser.
For one-time dashboard setup and webhook configuration, see Meld integration overview. For the end-to-end widget flow using raw HTTP calls, see the White-Label API guide.
Prerequisites
- An initialized Portal client with the iframe ready (
onReadyor equivalent). - Meld enabled for your Portal environment and configured in the dashboard.
Architecture
Prefer
portal.ramps.meld over lower-level APIs. The SDK types for requests and responses live in @portal-hq/web (see the Web SDK reference section portal.ramps.meld (Meld)).
Types and responses
Successful Client API responses use an envelope{ data: T, metadata?: Record<string, unknown> }. Methods on portal.ramps.meld return Promise of that envelope (for example MeldCreateRetailWidgetResponse is { data: { widgetUrl: string, ... } }).
Throwing or rejected promises usually indicate network errors, iframe timeouts, or API error payloads surfaced by the SDK — handle them with try/catch like other async Portal calls.
Customer methods
createCustomer
Creates a Meld customer record for the current Portal client. This is optional — the widget collects identity inline. Pre-creating is useful when you want to pre-fill KYC fields or track multiple sessions against a persistent customer record.
Returns —
MeldCreateCustomerResponse: { data: MeldCustomer }.
If a customer already exists for the current Portal client, the Portal API returns
409 Conflict with the existing customer ID at details.meldCustomerId. Retrieve the full record with searchCustomer() instead.searchCustomer
Returns the Meld customer record(s) associated with the current Portal client.MeldSearchCustomerResponse: { data: { customers: MeldCustomer[]; count: number; remaining: number } }.
data.customers will be empty if no customer has been created for this Portal client yet.
Retail methods
getRetailQuote
Fetches live pricing across Meld’s provider network before opening the widget. Returns oneMeldQuote per available provider.
Returns —
MeldGetRetailQuoteResponse: { data: { quotes: MeldQuote[]; message?: string; error?: string; timestamp?: string } }.
Each MeldQuote includes required fields: serviceProvider, transactionType, sourceAmount, sourceCurrencyCode, destinationAmount, destinationCurrencyCode, exchangeRate, transactionFee, totalFee, paymentMethodType; and optional nullable fields: sourceAmountWithoutFees, destinationAmountWithoutFees, networkFee, partnerFee, fiatAmountWithoutFees, countryCode, customerScore, institutionName, isNativeAvailable, rampIntelligence.
createRetailWidget
Creates a Meld widget session and returns awidgetUrl. Open the URL in a new browser tab to let the user complete the buy/sell/transfer flow.
MeldSessionData fields
Returns —
MeldCreateRetailWidgetResponse: { data: { id: string; token: string; customerId: string; externalCustomerId: string; externalSessionId: string; widgetUrl: string } }.
searchRetailTransactions
Lists Meld retail transactions for the current Portal client with optional filtering.
Returns —
MeldSearchRetailTransactionsResponse: { data: { transactions: MeldTransaction[]; count: number; remaining: number; totalCount: number } }.
getRetailTransaction
Fetches a single retail transaction by its Meld transaction ID.
Returns —
MeldGetRetailTransactionResponse: { data: { transaction: MeldTransaction } }.
getRetailTransactionBySession
Fetches the retail transaction associated with a widget session ID.
Returns —
MeldGetRetailTransactionResponse: { data: { transaction: MeldTransaction } }.
Prefer Meld webhooks over polling for transaction lifecycle updates. Configure them in Meld Dashboard — see Webhooks.
Discovery methods
Discovery endpoints return Meld’s current catalog of supported countries, currencies, payment methods, and limits. Call them at startup or lazily before populating dropdowns. All discovery methods accept an optionalMeldDiscoveryParams object. It accepts countryCode and any additional filter keys Meld documents.
getServiceProviders
MeldGetServiceProvidersResponse: { data: MeldServiceProvider[] }.
Each MeldServiceProvider includes: serviceProvider, name, status, categories, categoryStatuses, websiteUrl, customerSupportUrl, and logos (dark/light variants).
getCountries
MeldGetCountriesResponse: { data: MeldCountry[] }.
Each MeldCountry includes: countryCode, name, flagImageUrl, and optional regions: { regionCode, name }[].
getFiatCurrencies
MeldGetFiatCurrenciesResponse: { data: MeldFiatCurrency[] }.
Each MeldFiatCurrency includes: currencyCode, name, symbolImageUrl.
getCryptoCurrencies
MeldGetCryptoCurrenciesResponse: { data: MeldCryptoCurrency[] }.
Each MeldCryptoCurrency includes: currencyCode, name, chainCode, chainName, chainId, contractAddress, symbolImageUrl.
Meld doesn’t accept a separate chain parameter — each token has a distinct
currencyCode per chain (a “Meld Code”). Pass the same code from the quote into the widget session so pricing and settlement match.getPaymentMethods
MeldGetPaymentMethodsResponse: { data: MeldPaymentMethod[] }.
Each MeldPaymentMethod includes: paymentMethod, name, paymentType, and optional logos.
getDefaults
Returns the default fiat currency and payment methods per country.MeldGetDefaultsResponse: { data: MeldCountryDefault[] }.
Each MeldCountryDefault includes: countryCode, defaultCurrencyCode, defaultPaymentMethods: string[].
getBuyLimits
Returns minimum, maximum, and default purchase amounts per fiat currency.MeldGetBuyLimitsResponse: { data: MeldFiatCurrencyPurchaseLimit[] }.
Each MeldFiatCurrencyPurchaseLimit includes: currencyCode, defaultAmount, minimumAmount, maximumAmount.
getSellLimits
Returns minimum, maximum, and default sell amounts per crypto currency.MeldGetSellLimitsResponse: { data: MeldCryptoCurrencySellLimit[] }.
Each MeldCryptoCurrencySellLimit includes: currencyCode, chainCode, defaultAmount, minimumAmount, maximumAmount.
getKycLimits
Returns transaction limits per KYC tier and fiat currency.MeldGetKycLimitsResponse: { data: MeldKycFiatLevel[] }.
Each MeldKycFiatLevel includes: currencyCode and optional level1, level2, level3 of type MeldKycLimitTier, each containing dailyLimit, weeklyLimit, monthlyLimit, yearlyLimit, and transactionLimit.
End-to-end example
The following example shows the recommended buy flow: discover, quote, create a widget session, and look up the result.Error handling
Wrap calls intry/catch. Portal forwards Meld’s HTTP status codes (4xx/5xx) and preserves the upstream error message.
Common Portal-side errors:
400 Meld integration is not enabled— turn on the Meld integration for the current Portal environment in the Portal Dashboard.400 Meld API key is not configured for this environment— paste a valid Meld API key into the integration config.409 Conflict(oncreateCustomer) — a Meld customer already exists for this Portal client. CallsearchCustomer()to retrieve it.
Related documentation
- Web SDK reference (section portal.ramps.meld (Meld))
- Meld integration overview
- White-Label API guide
- Webhooks