Trading
Onramp
Quote a fiat-to-crypto purchase and open the provider checkout for a supported wallet.
POST /ramp/quotes and POST /ramp/session require x-app-id; a user token is not required.
The purchase sends crypto to walletAddress. To fund an sufwan-local-test managed balance, first obtain the
correct address and supported chain from Funding.
sourceAmount is a decimal string in sourceCurrencyCode units ("50" is fifty dollars, not atomic units).
const quotes = await client.getRampQuotes({
sourceAmount: "50",
sourceCurrencyCode: "USD",
destinationCurrencyCode: "USDC",
});
if (!quotes.length) throw new Error("No onramp quote is available for this purchase");
const session = await client.createRampSession({
sourceAmount: "50",
sourceCurrencyCode: "USD",
destinationCurrencyCode: "USDC",
serviceProvider: quotes[0].serviceProvider,
walletAddress,
});
// session.widgetUrl is the checkout to openFull shapes on Get crypto purchase quotes and Create a ramp widget session for checkout.