SDK
Javascript
How to
Off Ramp
Quote

Get Off-Ramp Quote

This method allows you to get a quote for an off-ramp transaction.

Method Signature

async quote(params: XellarOffRampQuoteRequest): Promise<XellarOffRampQuoteResponse>

Parameters

params: XellarOffRampQuoteRequest - An object with the following properties:

  • amount: number (required) - The amount of the off-ramp transaction in the input currency.
  • inputCurrency: string (required) - The crypto id of the off-ramp transaction (e.g., "usdc-polygon"). See Reference for available options.
  • outputCurrency: string (required) - The currency of the off-ramp transaction (e.g., "IDR"). See Reference for available options.
  • withLimit: boolean (optional) - When set to false, no daily limit calculation is applied to the quote based on the user's limits (pure quote only).

Returns

Promise<XellarOffRampQuoteResponse> - An object containing the off-ramp quote details.

Example Usage

const quote = await sdk.offRamp.quote({
  amount: 10,
  inputCurrency: 'usdc-polygon',
  outputCurrency: 'SGD',
  withLimit: true
});
console.log(quote);

Response Example

{
    "status": true,
    "coin": "usdc",
    "currency": "IDR",
    "amount": 10,
    "rate_amount": 15539.445,
    "amount_in_currency": 155394.45,
    "total_fee_percentage": 3.867141758923822,
    "total_fee_amount": 0.3867141758923822,
    "total_fee_amount_in_currency": 6009.323667,
    "total_received_amount": 9.613285824107617,
    "total_received_amount_in_currency": 149385.126333,
    "payout_wallet": "0x03XXXXXXX4",
    "expiry_time": 15
}
ℹ️

The response includes details such as the exchange rate, fees, and the final amount to be received in both crypto and fiat currency. The payout_wallet field provides the wallet address where the crypto assets should be sent.

Additional Information

  • The withLimit parameter allows you to get a quote using only the client secret, without including your user access token in request headers. This is useful for client-side applications.
  • When withLimit is set to false, no daily limit calculation is applied to the quote based on the user's limits (pure quote only).
  • The quote includes a payout_wallet address where the crypto assets should be sent to complete the off-ramp transaction.
  • The quote has an expiry_time in minutes after which the quoted rates are no longer valid.

For more information, see the Rampable Off-Ramp Quote API Documentation (opens in a new tab).