Skip to main content
Use this method to request a quote for fiat-to-crypto transactions. Quotes include fees and limits, and they expire after a short time window. A quote with executable: true can be used to execute a transaction.
Get a quote
import { useMoonPay } from "@moonpay/platform-sdk-react-native";

export function QuoteScreen() {
  const { client } = useMoonPay();

  const requestQuote = async () => {
    const quoteResult = await client.getQuote({
      source: { asset: { code: "USD" }, amount: "100.00" },
      destination: { asset: { code: "ETH" } },
      wallet: { address: "0x1234567890123456789012345678901234567890" },
      paymentMethod: { type: "apple_pay" },
    });

    if (!quoteResult.ok) {
      // Handle error
      console.error(quoteResult.error.code, quoteResult.error.message);
      return;
    }

    console.log(quoteResult.value.data);
  };

  // ...
}

Parameters

client.getQuote() takes a single input object. The shape matches the Get quotes API request body — see that page for the complete field reference.
FieldTypeRequiredDescription
sourceobjectThe fiat side of the quote.
source.asset.codestringThe fiat currency code as ISO 4217 (for example, "USD").
source.amountstringThe amount to spend, as a string (for example, "100.00"). Set the amount on either source or destination, not both.
destinationobjectThe crypto side of the quote.
destination.asset.codestringThe crypto asset code the customer receives (for example, "ETH", "USDC_SOL").
destination.amountstringThe amount the customer receives, if known. Set the amount on either source or destination, not both.
walletobjectWhere the crypto is sent. Required for the quote to be executable.
wallet.addressstringThe destination wallet address.
wallet.tagstringAn optional memo or destination tag, used by some blockchains such as XRP or XLM.
paymentMethodobjectThe payment method to quote against. Required for the quote to be executable.
paymentMethod.typestringThe payment method type (for example, "apple_pay", "google_pay", "card").
paymentMethod.idstringThe stored payment method ID. Required when type is "card" to identify the specific card.
feeBehaviorstringHow fees relate to source.amount. One of "inclusive" or "exclusive". Defaults to "inclusive". Only applies when you quote by source.amount; it is ignored when you quote by destination.amount.
This method does not require a separate auth token. The client uses stored credentials from an active connection.

Fee behavior

feeBehavior controls whether fees are taken out of source.amount or added on top of it. It only applies when you quote by source.amount.
  • "inclusive" (default): the customer pays exactly source.amount, and fees are carved out of it. Less of the source amount is converted, so the customer receives less crypto. This is the existing behavior, so omitting feeBehavior keeps quotes unchanged.
  • "exclusive": fees are added on top of source.amount, so the customer pays source.amount plus fees. The full source.amount is converted, so the customer receives more crypto than the inclusive quote for the same input.
When you quote by destination.amount, MoonPay ignores feeBehavior and the quote is always fees-inclusive. The response always echoes the effective feeBehavior: the value you requested for source-amount quotes, or "inclusive" for destination-amount quotes.
Quote with fees added on top
const quoteResult = await client.getQuote({
  source: { asset: { code: "USD" }, amount: "100.00" },
  destination: { asset: { code: "ETH" } },
  wallet: { address: "0x1234567890123456789012345678901234567890" },
  paymentMethod: { type: "apple_pay" },
  feeBehavior: "exclusive",
});

Result

client.getQuote() returns a Result<{ data: Quote }, GetQuoteError>.

Result envelope

Result<{ data: Quote }, GetQuoteError>
FieldTypeRequiredDescription
okbooleanWhether the operation succeeded.
value{ data: Quote }Present when ok is true.
errorGetQuoteErrorPresent when ok is false.

Quote

A quote includes a signature you use to execute a transaction, plus fees and limits. See the API reference for the full shape.
FieldTypeRequiredDescription
signaturestringA stringified JSON object that contains quote data and an embedded hash. Don’t deserialize this value. Use it as-is to execute a transaction.
expiresAtstringAn ISO 8601 timestamp for when the quote expires.
sourceobjectThe source (fiat) asset details.
destinationobjectThe destination (crypto) asset details.
walletobjectThe destination wallet details.
feesobjectFee details for the transaction.
feeBehaviorstringThe effective fee behavior for this quote, "inclusive" or "exclusive". Echoes the requested value for source-amount quotes, or "inclusive" for destination-amount quotes.
executablebooleanWhether the quote can be used to execute a transaction. See the API reference for the request fields required to receive executable: true.

GetQuoteError

GetQuoteError is the standard MoonPay Platform API error shape, DevPlatformApiError.
FieldTypeRequiredDescription
codeDevPlatformApiErrorCodeA machine-readable error code (for example, "invalid_request", "unauthorized", "unprocessable_entity"). See the error reference for the full list.
messagestringA developer-friendly message.
errorsDevPlatformApiErrorDetail[]Optional list of field-level errors when the request fails validation. Each entry has a field and message.
types.ts
type DevPlatformApiErrorCode =
  | "unknown_error"
  | "unauthorized"
  | "forbidden"
  | "not_found"
  | "invalid_request"
  | "not_implemented"
  | "too_many_requests"
  | "not_allowed"
  | "conflict"
  | "unprocessable_entity"
  | "sse_timeout"
  | "sse_error"
  | "service_unavailable"
  | "requirements_incomplete"
  | "verification_rejected"
  | "country_mismatch"
  | "unsupported_country";

type DevPlatformApiErrorDetail = {
  field?: string;
  message: string;
};

type GetQuoteError = {
  code: DevPlatformApiErrorCode;
  message: string;
  errors?: DevPlatformApiErrorDetail[];
};