skip to Main Content

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.

2

Answers


  1. 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

    Login or Signup to reply.
  2. You’ll need a currency conversion package. There are multiple paid options provided by companies and there are some free tools. The link below is for a free currency conversion tool. Use this tool with the rate caching option to get real time exchange rates or to directly convert any amount from one currency to another.

    https://www.npmjs.com/package/currency-converter-lt

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search