Skip to main content

Currency Exchange

Introduction

The Currency Exchange module exposes features for managing currency exchanges.

CurrencyExchangeService

Use CurrencyExchangeService to manage currency exchanges.

Create an FxRate

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

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { FxRateRequest } from '@paysafe/paysafe-wallet-saas-web/currency-exchange';

const fxRateRequest : FxRateRequest = {
sourceCurrency: 'GBP',
targetCurrency: 'EUR'
}

Wallet.getInstance().getCurrencyExchangeService().createQuote(fxRateRequest)
.then(response => console.log('Create FX quote', response))
.catch(error => console.error('Error create FX quoter', error));

Get an FxRate

To get created FxRate use getQuote

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';

const quoteId = '2f491c83-c425-4299-a590-e9cc577af8de'

Wallet.getInstance().getCurrencyExchangeService().getQuote(quoteId)
.then(response => console.log('Get FX quote', response))
.catch(error => console.error('Error get FX quoter', error));