firebasevue.jslocalizationinternationalizationcurrency

Alternatives for multi currency web application


I want to develop my own web application on Vue.js and Firebase where uses can buy products or services using a payment API (paypal or stripe).

I would like to show the prices of these products in local currency of each user, but I dont figure out how to approach the problem. Perhaps using a currency conversion external API?

Please if anybody has faced this problem once I would like to know what alternatives (libraries, api, code samples...) exist to solve this on Vue.js and Firebase.


Solution

  • You will need to find the common exchange rates for the currency on the client. Re-calculating the prices in your database is inefficient. instead, you store the current trading value from a source and multiply that from your base value.

    USD to RUPE is 1203% - simply multiplying the value by 1203will render it as the correct price

    There are several sources that offer exchange rates, this could be an npm package like the following: https://www.npmjs.com/package/currency-converter