Skip to main content

Documentation Index

Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt

Use this file to discover all available pages before exploring further.

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: "USD",
      destination: "ETH",
      sourceAmount: "100.00",
      walletAddress: "0x1234567890123456789012345678901234567890",
      paymentMethod: "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. See the Get quotes API for the complete field reference, including optional fields such as destinationAmount and externalCustomerId.
FieldTypeRequiredDescription
sourcestringThe fiat asset code used for payment (e.g., "USD", "EUR").
destinationstringThe crypto asset code the customer receives (e.g., "ETH", "BTC").
sourceAmountstringThe amount to purchase in the source asset, as a string (for example, "100.00"). Provide either sourceAmount or destinationAmount.
walletAddressstringThe destination wallet address.
paymentMethodstring | objectThe payment method to quote against. Pass a string (for example, "apple_pay") or, for stored cards, an object { type: "card", id: "<paymentMethodId>" }.
This method does not require a separate auth token. The client uses stored credentials from an active connection.

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.
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"
  | "connection_required"
  | "connection_pending"
  | "connection_unavailable"
  | "service_unavailable"
  | "requirements_incomplete"
  | "verification_rejected"
  | "country_mismatch"
  | "unsupported_country";

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

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