Skip to main content

Currency Exchange

Introduction

The Currency Exchange service exposes features for:

  • Getting currency exchange rate quote
  • Creating currency exchange rate quote

Use the following code to obtain an instance of CurrencyExchangeService:

val currencyExchangeService = Wallet.getInstance().getCurrencyExchangeService()

Get an FxRate

Use getQuote method to retrieve an FxRate by passing the id of the FxRate:

try {
val id = "404679be-ccbf-4528-b880-e14cc5041753"
val fxRate = currencyExchangeService.getQuote(id)
Log.d(TAG, fxRate.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Create an FxRate

Use createQuote method to create an FxRate for the current source and target currencies:

FxRateRequest

ParameterData typeDescriptionExample
sourceCurrencystringRequired parameter for currency of the fxRateQuote. Format ISO 4217."USD"
targetCurrencystringRequired parameter for currency of the fxRateQuote. Format ISO 4217."EUR"
try {
val fxRateRequest = FxRateRequest(sourceCurrency = "USD", targetCurrency = "EUR")
val fxRate = = currencyExchangeService.createQuote(fxRateRequest)
Log.d(TAG, fxRate.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}