Skip to main content

Off-Ramp

Sell crypto for fiat (crypto-to-fiat conversion). Access via zenpays.offRamp.

Methods​

getQuotes​

Get sell quotes for a crypto-to-fiat currency pair.

const quotes = await zenpays.offRamp.getQuotes({
source: 'usdt_tron',
destination: 'NGN',
amount: 100,
paymentMethod: 'bank_transfer',
country: 'NG',
})

Response​

Returns an array of quotes from available providers:

[
{
"onramp": "zenpay",
"paymentMethod": "bank_transfer",
"inputAmount": 100,
"outputAmount": 157500,
"rate": 1575,
"networkFee": 0,
"transactionFee": 1.5,
"totalFee": 1.5,
"recommended": true,
"minAmount": 5,
"maxAmount": 10000
}
]

getRates​

Get exchange rates for one or more fiat destinations.

const rates = await zenpays.offRamp.getRates({
source: 'usdt_tron',
destinations: 'NGN,GHS,KES',
amount: 100,
})

createCheckout​

Initiate a generic off-ramp checkout session (legacy).

const checkout = await zenpays.offRamp.createCheckout({
onramp: 'zenpay',
source: 'usdt_tron',
destination: 'NGN',
amount: 100,
type: 'sell',
paymentMethod: 'bank_transfer',
walletAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD28',
})

createSellCheckout​

Phase 1 of the two-phase sell flow — generate a crypto deposit address. Requires a ramp intent.

const sellCheckout = await zenpays.offRamp.createSellCheckout({
intentId: 'ri_1710345678000_a1b2c3d4e5f6g7h8',
cryptoCurrency: 'USDT',
chain: 'tron',
fiatCurrency: 'USD',
cryptoAmount: 20,
fiatAmount: 19.78,
rate: 0.999,
totalFee: 0.62,
})

Parameters​

FieldTypeRequiredDescription
intentIdstringYesRamp intent ID
cryptoCurrencystringYesCrypto to sell (e.g. USDT)
chainstringYesBlockchain network (e.g. tron, ethereum)
fiatCurrencystringYesTarget fiat currency
cryptoAmountnumberYesAmount of crypto to sell
fiatAmountnumberYesExpected fiat proceeds
ratenumberYesLocked exchange rate
totalFeenumberYesTotal fees
customerEmailstringNoCustomer email (for KYC, optional if kycVerified)
customerFirstNamestringNoCustomer first name
customerLastNamestringNoCustomer last name
quoteIdstringNoQuote ID from quotes endpoint

Response​

{
"intentId": "ri_1710345678000_a1b2c3d4e5f6g7h8",
"depositAddress": "TLfMkVBKQSy8i1XN2wDCQxkPaL1Dqz7v98",
"memo": null,
"currency": "USDT",
"chain": "tron",
"expectedCryptoAmount": 20,
"fiatAmount": 19.78,
"fiatCurrency": "USD",
"rate": 0.999,
"cryptoDepositId": "d4e5f6a7-b8c9-1234-5678-abcdef012345",
"expiresAt": "2026-03-15T10:00:00.000Z",
"provider": "fireblocks"
}

getSellPayoutPreview​

Phase 2a — discover required beneficiary fields and fees for the target currency/country.

const preview = await zenpays.offRamp.getSellPayoutPreview({
intentId: 'ri_1710345678000_a1b2c3d4e5f6g7h8',
fiatCurrency: 'USD',
country: 'US',
payoutType: 'bank_transfer',
})

Parameters​

FieldTypeRequiredDescription
intentIdstringYesRamp intent ID
fiatCurrencystringYesTarget fiat currency
countrystringNoISO country code
payoutTypestringNoPayout method (default: bank_transfer)

Response​

{
"selectedTsp": "zenpay_routing",
"tspDisplayName": "PayCross",
"requiredFields": [
{ "fieldName": "receiverFirstName", "label": "First Name", "type": "string", "required": true },
{ "fieldName": "receiverLastName", "label": "Last Name", "type": "string", "required": true },
{ "fieldName": "receiverAccountNumber", "label": "Account Number", "type": "string", "required": true }
],
"optionalFields": [],
"fiatAmount": 19.78,
"fiatCurrency": "USD",
"fees": { "platform": 0.22, "network": 0, "total": 0.22 }
}

createSellPayout​

Phase 2b — submit beneficiary details to trigger the fiat payout.

const payout = await zenpays.offRamp.createSellPayout({
intentId: 'ri_1710345678000_a1b2c3d4e5f6g7h8',
cryptoDepositId: 'd4e5f6a7-b8c9-1234-5678-abcdef012345',
fiatCurrency: 'USD',
country: 'US',
selectedTsp: 'zenpay_routing',
beneficiaryDetails: {
receiverFirstName: 'John',
receiverLastName: 'Doe',
receiverAccountNumber: '123456789',
receiverBankName: 'Bank of America',
receiverCountry: 'US',
},
})

Parameters​

FieldTypeRequiredDescription
intentIdstringYesRamp intent ID
cryptoDepositIdstringYesDeposit ID from sell checkout response
fiatCurrencystringYesTarget fiat currency
payoutTypestringNoPayout method (default: bank_transfer)
countrystringNoISO country code
selectedTspstringNoProvider from payout preview response
beneficiaryDetailsobjectYesDynamic fields from payout preview requiredFields

Response​

{
"payoutId": "po_abc123def456",
"status": "processing",
"amount": 19.78,
"currency": "USD",
"intentId": "ri_1710345678000_a1b2c3d4e5f6g7h8"
}

getTransaction​

const txn = await zenpays.offRamp.getTransaction('txn_xxx')

createWidgetUrl​

Generate a hosted widget URL for off-ramp.

const { url } = await zenpays.offRamp.createWidgetUrl({
mode: 'sell',
defaultFiat: 'usd',
defaultCrypto: 'usdt_tron',
defaultAmount: 100,
networkWallets: 'tron:TLfMkVBKQSy...',
successRedirectUrl: 'https://yoursite.com/success',
failureRedirectUrl: 'https://yoursite.com/failure',
})
// Embed url in iframe or redirect user

Parameters​

FieldTypeRequiredDescription
modestringNobuy, sell, or buy,sell
defaultFiatstringNoDefault fiat currency
defaultCryptostringNoDefault crypto
defaultAmountnumberNoDefault amount
networkWalletsstringNoFormat: network:address,network:address
successRedirectUrlstringNoRedirect on success
failureRedirectUrlstringNoRedirect on failure
emailstringNoPre-fill customer email
uuidstringNoUser identifier