swig.ramp covers both directions. Direction is carried by the buy or sell
order you pass, so there is no separate on-ramp or off-ramp client.
Required configuration
getOptions / get_options, getQuotes / get_quotes, and createOrder /
create_order require both fields below.
getOrder / get_order, prepareTransfer / prepare_transfer, and
submitTransfer / submit_transfer identify the stored order in the route and
require neither field.
The provider environment is not a Solana cluster. A sandbox order still settles
on mainnet.
Amounts and assets
Amounts are integers in the smallest unit —minorUnits for fiat (cents for
USD, whole yen for JPY) and baseUnits for crypto. They cross the wire as
decimal strings so a value above 2^53 survives, and an amount finer than the
currency’s minor unit is refused rather than rounded. In TypeScript, use a
bigint or decimal string above the safe-integer range; unsafe number values
are rejected before the request is sent.
Crypto is a two-case asset: native SOL, or an SPL mint.
TypeScript
Read the options
Read the options first, so currency, payment-method, and asset values come from the API rather than a hardcoded list.decimals and exponent are the scales
you need to build a valid amount.
TypeScript
countries (each with subdivisions), fiatCurrencies /
fiat_currencies, paymentMethods / payment_methods, and assets.
Quote a route
TypeScript
route and a details arm holding the priced amounts, the
total fee, and the exchange rate.
Create an order
requestId / request_id is your idempotency key and is unique within the
configuration. Repeating it returns the stored order; repeating it with
different inputs is refused. Mint it before the first attempt and reuse it
across retries — the SDK retries this call for you on a transient failure.
TypeScript
order.launchUrl / order.launch_url.
Follow the order
Poll the order until its status is final. A read of a non-final order also reconciles it against the provider, so polling is what advances it.TypeScript
unspecified, creating, creation-uncertain,
awaiting-customer, awaiting-transfer, processing, settling, settled,
declined, cancelled, failed, and refunded. refunded can follow
settled, so a settled order is not necessarily the last word.
Sell: create, check out, transfer
A sell is its own order. The examples above create a buy, and a transfer prepared against one is refused withonly a sell needs a transfer, so quote
the sell direction and create a second order for it.
Create that order on mainnet. A transfer prepared on any other network is
refused with ramp transfers settle on mainnet only, and the order context’s
network wins over the client’s default. The provider environment is separate: a
sandbox order still settles on mainnet.
TypeScript
awaiting-transfer and carries a deposit.
Preparing earlier is refused with the deposit address is not ready.
TypeScript
TypeScript
unspecified, prepared, submitted, landed, failed, and expired; a
transfer settles only at confirmed or better.
The prepared transaction is handed over exactly once. If you broadcast it and
then lose it, submit again without a signed transaction to resolve the attempt
that is already live.
TypeScript
landed raises, and the error says which attempt you still own: keep the order
and transfer ids, resolve the same attempt again while it is still confirming,
and prepare a replacement only once one is reported as failed. See
Submit a transfer for the exact
responses.
Routes behind the clients
Your application owns the API key, the customer identifier it sends as
customerId, and the signing key for a sell. Keep the API key on the server and
out of any browser bundle. See the Ramp API for the raw
REST contract.
