JavaScript SDK
The@nowramp/sdk package provides the RampApi client for fetching quotes, creating checkouts, and tracking transactions across multiple payment gateways.
Installation
Quick Start
RampApi Class
Constructor
Configuration
Methods
getSupported(params?)
Get supported configuration (gateways, currencies, payment methods) across all enabled providers.| Parameter | Type | Description |
|---|---|---|
orderType | 'buy' | 'sell' | Filter by order type (default: 'buy') |
country | string | ISO 2-letter country code (auto-detected from IP if omitted) |
getQuotes(params)
Get quotes from all enabled gateways, ranked by best rate.| Parameter | Type | Required | Description |
|---|---|---|---|
fiatCurrency | string | Yes | Fiat currency code (e.g., 'USD') |
cryptoCurrency | string | Yes | Crypto currency code (e.g., 'ETH') |
network | string | Yes | Network ID (e.g., 'ethereum') |
fiatAmount | string | One required | Fiat amount (for buy orders) |
cryptoAmount | string | One required | Crypto amount (for sell orders) |
orderType | string | No | 'buy' or 'sell' (default: 'buy') |
paymentMethodId | string | No | Filter by payment method |
country | string | No | ISO 2-letter country code |
createCheckoutIntent(params)
Create a checkout with a specific gateway. Returns a checkout URL for iframe or redirect.| Parameter | Type | Required | Description |
|---|---|---|---|
gateway | string | Yes | Gateway ID from supported config |
fiatCurrency | string | Yes | Fiat currency code |
cryptoCurrency | string | Yes | Crypto currency code |
network | string | Yes | Network ID |
fiatAmount | string | One required | Fiat amount |
cryptoAmount | string | One required | Crypto amount |
walletAddress | string | Yes (buy) | Destination wallet address |
externalCustomerId | string | No | Your user ID |
email | string | No | Customer email |
redirectUrl | string | No | URL after checkout |
metadata | object | No | Key-value metadata |
getTransaction(transactionId)
Get transaction status, synced with the gateway’s latest data.validateAddress(params)
Validate a wallet address format.getSupportedNetworks()
Get supported networks for address validation.Standalone Functions
Common API functions are also exported as standalone functions for minimal setup:TypeScript Support
The SDK includes full TypeScript definitions:UMD Build
For non-bundled usage via CDN:Browser Support
| Browser | Version |
|---|---|
| Chrome | 80+ |
| Firefox | 75+ |
| Safari | 13+ |
| Edge | 80+ |
Bundle Size
| Build | Size |
|---|---|
| ESM (minified) | ~15KB |
| UMD (minified) | ~18KB |
| Gzipped | ~5KB |
Legacy Methods (Deprecated)
getRate(params) — deprecated
Get a conversion rate from a single provider. Returns one rate instead of comparing across gateways.| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Source currency code (e.g., 'USD') |
to | string | Yes | Destination currency code (e.g., 'ETH') |
amount | number | Yes | Amount in source currency |
flowType | 'buy' | 'sell' | No | Order type (default: 'buy') |
RateResult
getRate() with getQuotes() to compare rates across all gateways:
getCurrencies() — deprecated
Get available currencies from a single configured provider.getCurrencies() with getSupported() to get currencies, payment methods, and gateways across all providers:
Standalone legacy functions
The legacy methods are also available as standalone functions:Next Steps
- Onramp API — Full endpoint documentation
- React Components — Drop-in checkout form with hooks
- Multi-Provider Quotes — Build a quote comparison UI