Exchange Rates
Exchange rates let you trade in currencies other than your base currency. A currency becomes selectable for tariffs, vendors, termination routes, customers, accounts, payment processors and vouchers once it has a rate here. FlySIP converts every amount between currencies with these rates, for example when an account in USD is charged by a tariff in EUR. Each customer keeps its own rates against its own base currency, so a reseller’s rates do not affect yours.
Where to find it
Section titled “Where to find it”Open Tariffs & Currencies → Exchange Rates in the left sidebar. The URL is /xrates.php. Logins without tariffs see the group as Currencies. The item is hidden for users restricted by an access level.
What you see
Section titled “What you see”The list shows every currency with a rate, except your base currency.
| Column | Meaning |
|---|---|
| Status | Warning triangle Exchange Rate is outdated. when the rate was not updated for more than a day. Empty otherwise |
| Currency Unit | Currency name and ISO code, linking to the form |
| <base> per Unit | How much of your base currency one unit of the currency costs, for example USD per Unit |
| Units per <base> | The same rate the other way round: units of the currency per one unit of your base currency |
| Source | Where the rate comes from: Manual Entry, Alpha Vantage, Currencylayer, Apilayer or Custom Script |
| Timestamp | Date and time of the last update, in your time zone |
A trash icon appears only for a currency nobody uses. The filter matches Currency Unit (is like or is not like) against the name or the ISO code, case-insensitively. It compares the whole value; use % as a wildcard, for example %dollar%.
Add an exchange rate
Section titled “Add an exchange rate”- Click Add.
- Select Currency Unit. The list offers the currencies that have no rate yet; all of them are listed in Supported currencies.
- Select Source.
- For Manual Entry, enter Exchange Rate and choose its direction: <base> per 1 Unit or Units per 1 <base>. For an online source, enter the API Access Key of your subscription with that provider.
- Click Save & Close.
For an online source the panel fetches the rate at once and refuses to save when it cannot. Cannot retrieve … communication with … has failed means the provider did not answer or rejected the key. The … does not support currency conversion means the provider does not quote this currency against your base currency; use Manual Entry for it.
Sources
Section titled “Sources”| Source | What you need | Updated |
|---|---|---|
| Manual Entry | The rate itself | Never. Edit the rate when it changes |
| Alpha Vantage | API Access Key from Alpha Vantage | Every 15 minutes |
| Currencylayer | API Access Key from Currencylayer. Tick Paid Subscription when your plan allows HTTPS; free plans are queried over plain HTTP | Hourly |
| Apilayer | API Access Key of the Currency Data API on Apilayer | Hourly |
| Custom Script | A script installed on the switch, see below. Shown only when the script exists | Every 15 minutes |
The updater runs every 15 minutes and refreshes each rate whose source interval has passed. When a provider fails, the rate keeps its last value and Timestamp stops moving; after a day the warning icon appears. Free plans limit the number of requests per month, and every currency is a separate request at every update; count them before you add many currencies on a free plan.
These providers are third-party services. FlySIP does not control their availability, pricing or terms, so check the Status column after any change on their side.
Use a custom script
Section titled “Use a custom script”A custom script lets you compute rates yourself, for example add a margin to a provider’s rate or read them from your bank. It needs shell access to the switch.
- Create the script
/var/env<N>/scripts/xrate_update_custom.sh, where<N>is the number of the environment (1for the main one). - Make it executable:
chmod 755 /var/env1/scripts/xrate_update_custom.sh. - Open Exchange Rates, add or edit a currency and select Custom Script as Source.
The script receives three arguments: the base currency, the currency, and a JSON string with options ({}). It must print one positive number, the amount of the currency per one unit of the base currency, and exit with code 0. Anything else counts as a failed update.
This example takes the Alpha Vantage rate and adds 5%:
#!/bin/sh# $1 = base currency, $2 = currency, $3 = options (JSON)# Prints the amount of $2 per one unit of $1.
SCALE=1.05KEY="your-alpha-vantage-key"
RATE=$(/home/ssp/scripts/python_exec.sh /home/ssp/scripts/xrate_update.py \ 1 AlphaVantage "$1" "$2" "{\"api_access_key\": \"$KEY\"}")
echo "scale=12; ${RATE} * ${SCALE}" | /usr/bin/bc -qReplace 1 after xrate_update.py with your environment number.
Edit an exchange rate
Section titled “Edit an exchange rate”Click the currency. Currency Unit is fixed; you can change Source, the key or, for Manual Entry, the rate. Saving fetches a fresh rate from an online source at once. The new rate applies to calls and payments from that moment; CDRs and payments already recorded keep their amounts.
Delete an exchange rate
Section titled “Delete an exchange rate”- Click the trash icon in the row.
- Click Delete in the confirmation.
The icon is shown only while no account, customer, tariff, payment processor or voucher of yours uses the currency, and for the root customer also no vendor or termination route. Move those to another currency first.
Related pages
Section titled “Related pages”- Supported currencies
- Tariffs
- Payments
- Rating and billing
- FAQ: changing the base currency
- Refund an account: conversion of API payments