=== RateExchanger ===
Contributors: jmartinez070484
Tags: currency, exchange rates, converter
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show live exchange rates, currency collections and conversions from RateExchanger.io with shortcodes or a block.

== Description ==

RateExchanger shows live currency exchange rates from [RateExchanger.io](https://rateexchanger.io/wordpress-plugin) on your WordPress site. You need a RateExchanger.io account and API key; a Free plan is available.

= Shortcodes =

* `[rateexchanger_rates title="Heading" description="Line under it"]`: a table of every currency against your base currency. All plans.
* `[rateexchanger_collection collection="ID" title="Heading" description="Line under it"]`: one of your collections. Without `collection` it shows your default collection. Plans that include collections.
* `[rateexchanger_convert from="USD" to="EUR" amount="100"]`: an amount converted from one currency to another. Plans that include conversions.

Every option is optional. `title` and `description` replace the table's heading and the line under it; `description=""` hides that line.

Every feature in this plugin is free and fully functional; the plugin doesn't lock anything itself. Which data an account can get is decided by the RateExchanger.io service. When its API refuses a collection or conversion, visitors see nothing and administrators see a note saying why.

= Block =

The Exchange Rates block (in the Widgets category) shows the same three things: all rates, a collection or a conversion. Pick one under Show in the block settings; the editor preview is the real output.

The Shortcodes tab under RateExchanger builds each shortcode with a live preview.

= Credit link =

The plugin can show a small "Rates by RateExchanger.io" link under rate tables. It is off by default and only appears if you turn it on on the Overview screen. Check RateExchanger.io's [terms of service](https://rateexchanger.io/terms) for whether your plan asks for attribution.

== External services ==

This plugin connects to the RateExchanger.io API (`https://rateexchanger.io/api`) to get exchange rates. It can't work without it.

* **What is sent:** your RateExchanger.io API key (as a bearer token) with every request. Rate requests can also send your base currency; conversion requests send the two currency codes being converted. No visitor data is sent.
* **When:** when you connect or refresh your account, when you open the plugin's admin screens, and when a page with a shortcode or block needs rates that aren't already cached. Rates are cached on your site, so most page views send nothing.
* **Endpoints used:** `/user/current` (account and usage), `/exchange` (latest rates), `/collection` (your collections) and `/convert` (conversions).

The service is provided by RateExchanger.io: [Terms of service](https://rateexchanger.io/terms), [Privacy policy](https://rateexchanger.io/privacy).

== Installation ==

1. Upload the `rateexchanger` folder to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate the plugin.
3. Open RateExchanger in the admin menu and paste your RateExchanger.io API key.

== Frequently Asked Questions ==

= Where do I get an API key? =

Create an account at [RateExchanger.io](https://rateexchanger.io/wordpress-plugin) and copy the key from your dashboard.

= How often are rates updated? =

Rates are cached and refreshed when RateExchanger.io publishes new ones. When it doesn't say, they're refreshed every 15 minutes, or less often (up to every hour) if your monthly request allowance on RateExchanger.io couldn't cover that. Developers can change the fallback with the `rateexchanger_rates_ttl` filter.

== Development ==

The source for the admin app is in `assets/js/admin/` and the block's source is in `blocks/exchange-rates/`. Run `npm install` and `npm run build` to compile `build/`, or `npm run start` to rebuild on change.

== Changelog ==

= 0.1.0 =
* First release.
* Connect screen to verify an API key and confirm the account.
* Overview screen: account summary, monthly usage, display settings (decimal places, number format, last-updated time, credit link) and API key management.
* Shortcodes `[rateexchanger_rates]`, `[rateexchanger_collection]` and `[rateexchanger_convert]`, with a Shortcodes tab to build them.
* Exchange Rates block for rates, a collection or a conversion.
