πŸ“©Get a Quote

For a merchant, if you have a fiat amount you expect the customer to pay-in, and you want to know how much of a given cryptocurrency for them to deposit.

Get a Quote via API

I want X USD β†’ User must pay Y Amount of Crypto

Quotes are meant to be used in conjunction with payment routes, which does not offer a β€œquote” by which a user can lock in a rate for a given amount of time, whereas, payment links do enable rate locks for a 15-30 minute window. The quote rates for this API are updated roughly every 15s.

This API is provided as a courtesy to estimate what you are likely to receive, to display in your web application for your customer to know how much crypto to transfer.

Example

  1. I'm a platform, game, marketplace, or web/mobile application

  2. I want the end-customer to pay-in 25 EUR

  3. The customer should then transfer 103.802 TRX on Tron

  4. I receive a webhook confirming a user transferred TRX on Tron

  5. I top up the customers account on my platform

As the merchant, you may get a quote and display the data.toAmount.amount + data.toAmount.currency.symbol to the customer:

GET https://pay-api.swapped.com/v1/quotes?fromAmount=25&fromFiatCurrency=EUR&toCurrency=TRX&toBlockchain=tron

Response:

{
  success: true,
  message: "success",
  data: {
    exchangeRateSnapshotId: "e29af432-8775-4642-b71c-fe4987681fa1",
    fromAmount: {
      amount: "25.00",
      currency: {
        symbol: "EUR",
        precision: 2,
        type: "FIAT",
        blockchain: null
      }
    },
    toAmount: {
      beforeFees: "103.802",
      afterFees: "103.802",
      currency: {
        symbol: "TRX",
        precision: 3,
        type: "CRYPTO",
        blockchain: {
          name: "tron"
        }
      }
    }
  }
}

API Spec

Get a quote for currency conversion

get

Get a quote for converting from one currency to another

Authorizations
X-API-KeystringRequired
Query parameters
fromAmountstringRequired
fromFiatCurrencystringRequired
toCurrencystringRequired
toBlockchainstringRequired
testbooleanOptional
Responses
get
/v1/quotes
200

Successful

Last updated