Currency exchange

Currency exchange typically takes place in the context of a transaction, e.g. a Purchase or a Refund. For this there are 3 different amounts/currencies to consider:

  • transaction amount (e.g. a Purchase for 10 USD)
  • merchant amount (e.g. shop settlement currency EUR)
  • consumer amount (e.g. wallet-account-currency SEK)

The following diagram illustrates the currencies, and what money is actually transferred / exchanged if required. The transaction-amount only determines the applicable consumer-amount and merchant-amount. Only if consumer-amount and merchant-amount have different currencies, the amount must be exchanged when transferred.

Please note that

  • the current implementation assumes identical exchange-rates are used for determining consumer and merchant amounts when the currencies are equal
  • currency-exchange takes place in the subsidiary of the consumer - the merchant-subsidiary always gets the emoney in the shop-settlement-currency
  • currency exchange is done when the emoney is transferred (e.g. when the Purchase changes status to Completed because the consumer provided sufficient usable emoney) - using the determined amounts when the purchase was Created/Confirmed. Any difference between that and the current exchange-rates is booked to system-accounts for 'currency-exchange-difference'
  • when a Purchase is cancelled, the currency-exchange is cancelled as well. Any difference between the original amounts and the current exchange-rate is booked to system-accounts for 'currency-exchange-difference'. This may be prevented by using a hedging-service that guarantees the exchange-rate upon cancellation.

A typical currency-exchange may be the following scenario:

  • Purchase of 10 USD is created / confirmed
    • MerchantAmount is determined at 8 EUR
    • ConsumerAmount is determined at 100 SEK
  • After 10 days, a payment for 100 SEK is created in the consumer-wallet (e.g. by bank-transfer), and the Purchase is set to Completed
    • The system books 100 SEK from the consumer to the currency-exchange-SEK account
    • The system sells 100 SEK to EUR
    • The exchangeService reports that 7.50 EUR was bought with 100 SEK
    • The system books the missing 0.50 EUR from the currency-exchange-difference-expense account to the currency-exchange-SEK account
    • The system books 8 EUR from the currency-exchange-SEK account to the shop

The same scenario in an inter-subsidiary purchase (where consumer and merchant belong to different subsidiaries):

When a Purchase is cancelled, the currency-exchange is cancelled as well.

  • The system cancels the transfer of 8 EUR from the currency-exchange-SEK account to the shop
  • The system buys 100 SEK for EUR (cancels the exchange)
  • The exchangeService reports that 8.50 EUR was required to buy 100 SEK
  • The system books the missing 0.50 EUR from the currency-exchange-difference-expense account to the currency-exchange-SEK account (no cancellation!)
  • The system cancels the transfer of 100 SEK from the consumer to the currency-exchange-SEK account

The same scenario in an inter-subsidiary purchase (where consumer and merchant belong to different subsidiaries):

Refunds are calculated using the currency-exchange-rate valid at the time of refund-creation, which may be different that when the purchase was created! Thus the consumer may see different results when a purchase is cancelled, or when a purchase is refunded.

Please note that once a successful refund exists for a purchase, a purchase-cancellation is mapped to a 'refund non-refunded-amount'.