Merchants and Currencies

The Virtual Cards Simulator comes pre-configured with a number of merchants and currency conversion rates.

The Virtual Cards Simulator comes pre-configured with a number of merchants that have a variety of characteristics that allow you to simulate different transactions. It also contains a small number of currency conversion rates.

Some merchants have specific behaviors that will cause particular decline codes to be generated when an authorization is requested. The returned SimulatorMerchant objects have a description field that provides a brief description of any special behavior of that merchant.

List the Simulator Merchants

The merchants that are defined in the simulator can be fetched by calling the getSimulatorMerchants API.

There are only a small number of merchants defined in the simulator, so this API does not require the results to be paged.

An example implementation of listing the merchants is:

try {
  const result = await simulatorClient.listSimulatorMerchants()
} catch (error) {
  // Handle error
}

If an exception occurs, the error or exception will contain a description of the fault that caused the exception.

List the Simulator Conversion Rates

The currency conversion rates that are defined in the simulator can be fetched by calling the getSimulatorConversionRates API.

There are only a small number of conversion rates defined in the simulator, so this API does not require the results to be paged.

An example implementation of listing the conversion rates is:

try {
  const rates = await simulatorClient.listSimulatorMerchants()
  const usd = rates.find((r) => { r.currency == "USD" })
  const aud = rates.find((r) => { r.currency == "AUD" })
  if (usd && aud) {
    const usdToAud = Number(aud.amount) / Number(usd.amount)
    console.log(`USD to AUD ${usdToAud}`)
  }
} catch (error) {
  // Handle error
}

The list of CurrencyAmount classes returned contain the currency code and the conversion rate amount expressed as an Int. To convert between two currencies find the CurrencyAmount class for each currency, convert the amount to a Double then divide the two rates. If an exception occurs, the error or exception will contain a description of the fault that caused the exception.

Last updated