Skip to main content

On-Ramp (Buy)

Buy crypto with fiat — checkout sessions, provider selection, quotes, rates, and configuration. Access via zenpays.checkout.

Widget Integration​

generateWidgetUrl​

Generate a signed widget URL for embedding on-ramp in your site.

const { url } = await zenpays.checkout.generateWidgetUrl({
mode: 'buy',
defaultFiat: 'usd',
defaultCrypto: 'btc_bitcoin',
defaultAmount: 100,
networkWallets: 'ethereum:0x123...',
successRedirectUrl: 'https://yoursite.com/success',
failureRedirectUrl: 'https://yoursite.com/cancel',
email: '[email protected]',
})
// Embed url in iframe or redirect user

selectProvider​

Select the optimal provider for an on-ramp transaction.

const result = await zenpays.checkout.selectProvider({
sessionId: 'cs_xxx',
amount: 100,
sourceCurrency: 'USD',
destinationCurrency: 'USDT',
country: 'US',
})

getProviderWidget​

Get the provider widget URL for embedding.

const widget = await zenpays.checkout.getProviderWidget('transak', 'cs_xxx')

getTransactionStatus​

const status = await zenpays.checkout.getTransactionStatus('txn_xxx')

Checkout Sessions​

createSession​

const session = await zenpays.checkout.createSession({
amount: 100,
currency: 'USD',
type: 'on_ramp',
destinationCurrency: 'USDT',
customerEmail: '[email protected]',
})

getSession​

const session = await zenpays.checkout.getSession('cs_xxx')

cancelSession​

const session = await zenpays.checkout.cancelSession('cs_xxx')

Ramp Orders​

getRampOrder​

const order = await zenpays.checkout.getRampOrder('ro_xxx')

getRampOrderStatus​

const status = await zenpays.checkout.getRampOrderStatus('ro_xxx')
// Returns: { orderId, status, updatedAt }

updateRampOrder​

const updated = await zenpays.checkout.updateRampOrder('ro_xxx', {
walletAddress: '0x123...',
network: 'ethereum',
})

Buy Quotes & Rates​

getBuyQuotes​

Get buy quotes for fiat-to-crypto conversion.

const quotes = await zenpays.checkout.getBuyQuotes({
source: 'USD',
destination: 'USDT',
amount: 100,
paymentMethod: 'card',
country: 'US',
})

getBuyRates​

Get exchange rates for multiple crypto destinations.

const rates = await zenpays.checkout.getBuyRates({
source: 'USD',
destinations: 'USDT,BTC,ETH',
amount: 100,
})

getBuyPrices​

Get current crypto prices in fiat.

const prices = await zenpays.checkout.getBuyPrices({
assets: 'BTC,ETH,USDT',
fiat: 'USD',
country: 'US',
})

createBuyCheckout​

Create a buy checkout (fiat to crypto).

const checkout = await zenpays.checkout.createBuyCheckout({
intentId: 'ri_1710345678000_a1b2c3d4e5f6g7h8',
cryptoCurrency: 'USDT',
chain: 'tron',
fiatCurrency: 'USD',
fiatAmount: 100,
cryptoAmount: 98.5,
rate: 1.0,
totalFee: 1.5,
})
// Returns: { intentId, paymentIntentId, checkoutUrl, fiatAmount, fiatCurrency, cryptoAmount, cryptoCurrency, chain, rate, expiresAt }

Configuration​

getConfig​

Get ramp provider configuration.

const config = await zenpays.checkout.getConfig()

getSupportedAssets​

Get supported crypto and fiat currencies.

const assets = await zenpays.checkout.getSupportedAssets({ type: 'buy', country: 'US' })

getPaymentMethods​

Get payment methods for a source currency.

const methods = await zenpays.checkout.getPaymentMethods('USD', {
destination: 'USDT',
country: 'US',
})

getDefaults​

Get default currencies and amounts per country.

const defaults = await zenpays.checkout.getDefaults({ type: 'buy', country: 'US' })

Geo & Currency​

detectGeo​

const geo = await zenpays.checkout.detectGeo()
// Returns: { country, currency, timezone, ... }

getBanks​

const banks = await zenpays.checkout.getBanks('INR')

searchBanks​

const results = await zenpays.checkout.searchBanks('INR', 'HDFC')

getCurrencies​

const currencies = await zenpays.checkout.getCurrencies()