top of page
Currency Converter

Currency Converter

Convert a specified amount of money from one currency to another

Intermediate.png

Intermediate

2K

Published:

January 20, 2021

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

In this example, site visitors select source and target currencies and specify an amount for conversion. After running the conversion, the target amount and timestamp of the conversion are displayed.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It


Page Elements


In our site we added the following elements:


  • 2 text inputs: for entering the amount to convert from, and for displaying the converted amount in the target currency

  • 2 dropdowns: for selecting the source and target currencies

  • Button: for triggering the conversion

  • Text element: for displaying the timestamp of the conversion rate



Page Code


Our code does the following:


  1. Import the currencies API from the wix-pay module.

  2. When the page loads, get all the currencies that Wix supports for currency conversion.

  3. Sort the currencies alphabetically.

  4. Set the currencies as the dropdown options.


When a site visitor clicks the Convert button, do the following:


  1. Get the amount to convert from the input and change it from a string to a number.

  2. Get the source and target currencies from the dropdowns.

  3. Convert the amount and get the result.

  4. Display the result.

  5. Display the exchange rate timestamp in the text element.

APIs We Used

Non-code example.

Non-code example.

Non-code example.

Non-code example.

Related Articles

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Customized Form

Customized Form

Customize a form with conditional logic

Intermediate.png

Intermediate

Collect Payments for a Single Product

Collect Payments for a Single Product

Collect quick and secure payments from your site visitors.

Intermediate.png

Intermediate

Anchor 2
bottom of page