Guides

FX quotes and rates

Before creating a cross-border payment, you'll typically want to check the exchange rate and get a quote that shows the payer exactly how much they'll pay. Nexpay provides two endpoints for this: the FX Rate API for quick rate lookups, and the Quotes API for detailed quotes with fee breakdowns per settlement method.


Before you start

You will need:

  • A valid API key to authenticate your requests.
  • A payee id (for quotes) — use the Payees API to create or retrieve one.

Checking the exchange rate

To get the current exchange rate between two currencies, use the FX Rate API. This is useful for displaying indicative rates before the payer commits to a payment.

try {
  const response = await fetch('https://api.nexpay.com/v2/fx-rate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'ApiKey your-api-key-here',
    },
    body: JSON.stringify({
      "fromCurrency": "USD",
      "toCurrency": "AUD",
      "amount": 1000
    }),
  });

  if (response.ok) {
    const data = await response.json();

    console.log(data);
  } else {
    throw new Error(`Request failed with status: ${response.status}`);
  }
} catch (error) {
  console.error(error);
}

The response includes the current rate for the currency pair:

{
  "rate": 1.0251,
  "fromCurrency": "USD",
  "toCurrency": "AUD"
}

Rate caching

FX rates are cached for 5 minutes. Subsequent requests for the same currency pair within that window will return the cached rate.

FX Rate fields

FieldTypeRequiredDescription
fromCurrencystringYes3-letter ISO 4217 source currency code (e.g. USD).
toCurrencystringYes3-letter ISO 4217 destination currency code (e.g. AUD).
amountnumberYesAmount to convert, in decimal form (minimum 0.01).

Creating a quote

While the FX Rate API gives you a quick rate check, the Quotes API provides a full breakdown with fees and multiple settlement method options. Use quotes when you're ready to show the payer their final costs.

To create a quote, you need to specify the payee, amount, currency, and transaction type:

try {
  const response = await fetch('https://api.nexpay.com/v2/quotes', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'ApiKey your-api-key-here',
    },
    body: JSON.stringify({
      "payeeId": 42,
      "amount": 5000,
      "currencyCode": "AUD",
      "transactionType": "provider"
    }),
  });

  if (response.ok) {
    const data = await response.json();

    console.log(data);
  } else {
    throw new Error(`Request failed with status: ${response.status}`);
  }
} catch (error) {
  console.error(error);
}

The response includes an array of variants — one for each available settlement method — so the payer can compare options:

{
  "id": "a1b2c3d4",
  "expiresAt": "2026-04-06T11:00:00.000Z",
  "variants": [
    {
      "settlementMethod": "dmt",
      "settlementChannel": "checkout",
      "payerRate": 1.0251,
      "fromCurrency": "USD",
      "fromAmount": 5125.5,
      "toCurrency": "AUD",
      "toAmount": 5000,
      "fee": 25.5,
      "totalAmount": 5151.0
    },
    {
      "settlementMethod": "bank-transfer",
      "settlementChannel": "volt",
      "payerRate": 1.0198,
      "fromCurrency": "USD",
      "fromAmount": 5099.0,
      "toCurrency": "AUD",
      "toAmount": 5000,
      "fee": 15.0,
      "totalAmount": 5114.0
    }
  ]
}

Quote request fields

FieldTypeRequiredDescription
payeeIdnumberYesThe payee (recipient) ID.
amountnumberYesAmount the payee will receive, in decimal form (minimum 0.01).
currencyCodestringYes3-letter ISO 4217 currency code of the payee's currency (e.g. AUD).
transactionTypestringYesThe type of payment: provider, company, or private.

Transaction types

TypeDescription
providerProvider/institution payments (e.g. university tuition, school fees).
companyBusiness-to-business payments.
privateIndividual/personal transfers (e.g. family remittances).

Understanding quote variants

Each variant in the response represents a different way the payer can send money. The fields in each variant are:

FieldDescription
settlementMethodThe payment method (e.g. dmt, bank-transfer, credit-card).
settlementChannelThe payment gateway processing the transaction (e.g. checkout, volt).
payerRateThe exchange rate from the payer's perspective.
fromCurrencyThe currency the payer sends (e.g. USD).
fromAmountThe amount the payer sends (before fees).
toCurrencyThe currency the payee receives (e.g. AUD).
toAmountThe amount the payee receives.
feeThe fee charged for this settlement method.
totalAmountThe total the payer pays (fromAmount + fee).

Retrieving a quote

You can retrieve a previously created quote by its id:

try {
  const response = await fetch('https://api.nexpay.com/v2/quotes/a1b2c3d4', {
    method: 'GET',
    headers: {
      'Authorization': 'ApiKey your-api-key-here',
    },
  });

  if (response.ok) {
    const data = await response.json();

    console.log(data);
  } else {
    throw new Error(`Request failed with status: ${response.status}`);
  }
} catch (error) {
  console.error(error);
}

Things to know

  • Quotes have an expiry time (expiresAt). Always check this before using a quote to create a payment — using an expired quote will return a [QOT0001] error.
  • Different settlement methods may have different rates and fees. Present all variants to the payer so they can choose the best option.
  • The amount in the quote request is the amount the payee receives (destination amount), not what the payer sends.
  • If the currency pair is unavailable, the API will return a [QOT0003] error. Use the FX Rate API to check supported pairs first.
  • FX rates fluctuate — always create a fresh quote close to when the payer is ready to pay.
Previous
Creating a payee