Skip to content

Buy / Sell — fiat on- and off-ramp

Fiat rails are Blazpay's emerging-market wedge. INR via UPI, plus twenty-odd currencies most global DEXs do not touch.

Route: /defi/buy-sell · Source: defi-dex/src/pages/defi/buy.tsx · Blazpay fee: none

What it does

The user enters a fiat amount and a target token. Blazpay queries every integrated ramp in parallel, shows the resulting crypto amount from each, and hands off to the winner's checkout flow. Crypto lands directly in the user's own wallet — Blazpay never receives it.

Off-ramp is the same flow in reverse.

Providers

ProviderStrengthController
OnRamp.moneyIndia — INR via UPI, IMPS, bank transfer. No international card neededcontrollers/defi/onRampController.js
ChangellyBroad currency coverage, both fiat and instant crypto-to-cryptochangelly.js, changellyFiat.js
AlchemyPayGlobal cards, strong APAC coveragealchemyController.js
TransakGlobal cards and bank railstransak.js
MoonPayGlobal cardsmoonPay.js

Quote comparison is unified in bz-backend/services/buy.js (buyQuotes), exposed as POST /defi/on-off-ramp-quotes.

Currencies

20+ fiat currencies covering India, Southeast Asia, the Middle East, Africa and LATAM:

INR  USD  EUR  GBP  AED  TRY  MXN  VND  NGN  BRL
PEN  COP  CLP  PHP  IDR  KES  ZAR  THB  MYR  ARS

The emerging-market entries — VND, NGN, KES, IDR, PHP, COP, PEN, CLP — are the differentiated ones. Most competing DEXs support USD and EUR and stop.

How it behaves

Reference assignment

Each provider needs a reference to correlate its webhook back to a Blazpay order. Every integration therefore has an assign* endpoint pair:

ProviderAssign cryptoAssign fiat
AlchemyPayGET /defi/alchemy/assignGET /defi/alchemy/assign-fiat
ChangellyGET /defi/changelly/assignGET /defi/changelly/assign-fiat
OnRamp.moneyGET /defi/onramp/assignGET /defi/onramp/save-fiat
TransakGET /defi/transak/assign

Catalogue sync

Provider catalogues (which tokens on which chains, which fiat currencies) are periodically pulled and cached in Mongo rather than queried live:

CollectionPopulated by
alchemyCrypto, alchemyFiatGET /defi/alchemy/save-crypto, /save-fiat
changellyCrypto, changellyFiatGET /defi/changelly/save-crypto, /save-fiat
onRampCryptoGET /defi/onramp/save-crypto
transacCrypto, transacFiatGET /defi/transak

These are administrative endpoints. Calling them refreshes the cache.

Webhooks

ProviderEndpoint
AlchemyPayGET /defi/alchemy/webhook
OnRamp.moneyPOST /defi/onramp/webhook (registered via POST /defi/onramp/setWebhook)
ChangellyPOST /defi/changelly/webhook-url

Orders are persisted in models/buySellOrders.js. Signed payloads for AlchemyPay come from POST /defi/alchemy/sign.

Order records

POST /defi/order/create and GET /defi/order/:walletAddress handle the Blazpay-side order record; POST /defi/order is the newer buyController.createOrder.

In BlazAI

The BUY intent routes here. The chat renders buy/BuyQuoteContainer (action buy_sell) with the same provider comparison inline, so a user can say "buy 10000 rupees of bitcoin" and get a comparison card without opening the trading app.

A separate BUY_BZ_TOKEN intent handles purchasing the native BLAZ token and renders presale/PresaleMessage.

Under the hood

ConcernWhere
Unified quotesbz-backend/services/buy.js
Chain / country mapsbz-backend/utils/onRampConst.js
Per-provider controllersbz-backend/controllers/defi/{onRampController,changelly,changellyFiat,alchemyController,transak,moonPay}.js
Frontenddefi-dex/src/pages/defi/buy.tsx (~970 lines)
SEO landing page/buy-crypto-inr via defi-dex/src/data/featureSeo.mjs

Endpoint-level detail: fiat API reference.

Known limits

  • Blazpay does not control provider pricing. The comparison is honest but each provider's spread is theirs; there is no negotiation layer.
  • KYC is the provider's. Blazpay does not hold identity documents, which also means it cannot resolve a stuck KYC — support has to redirect to the provider.
  • Catalogue drift. Because catalogues are cached in Mongo, a newly listed token on a provider does not appear until the corresponding save-crypto endpoint is called. There is no automatic refresh cron.
  • Off-ramp coverage is narrower than on-ramp for the emerging-market currencies; not every provider supports both directions for every corridor.

Internal + developer documentation. Usage figures are point-in-time snapshots — re-verify before publishing them.