=== SwiftPesa ===
Contributors: swiftpesa
Tags: calculator, tax calculator, salary calculator, mobile money, africa
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

PAYE take-home pay, M-Pesa and mobile money fee, loan and savings calculators for 12 African countries. Updates itself when rates change.

== Description ==

Writing about money in Kenya, Nigeria, South Africa, Ghana, Uganda or Tanzania? Tax bands and mobile money tariffs change every year or two, and every post with a fee table or a salary example quietly goes out of date.

**SwiftPesa keeps those numbers current for you.** Add a calculator, a fee table or a single figure to any post. When a revenue authority changes a tax band or a provider changes its tariff, your site picks up the new rules within hours. You don't edit a thing.

= What you can add =

* **Take-home pay calculator**: net pay after PAYE and payroll deductions (pension, social security, health insurance, housing levy) for Kenya, Nigeria, South Africa, Ghana, Uganda, Tanzania, Zambia, Zimbabwe, Botswana, Namibia, Lesotho and Malawi. Monthly or yearly, with effective and marginal rates. Show one country, or let visitors pick.
* **Mobile money fee calculator**: what it costs to send, withdraw or pay for any amount with M-Pesa, MTN MoMo, Airtel Money, EcoCash, Orange Money, Mixx by Yas and others.
* **Fee table that updates itself**: the full tariff, band by band, the table bloggers usually copy by hand. Show every column or only the ones you need.
* **Central bank rates and inflation**: policy rates and inflation for 12 countries, with the date, the official source and whether each rate went up or down.
* **Loan, savings and SACCO calculators**: mortgage and personal loan repayments, money market fund and compound interest growth, SACCO dividends, and PesaLink bank transfer fees by bank.
* **Live figures inside your sentences**: write "Sending KES 2,500 costs `[swiftpesa_value type="fee" country="ke" amount="2500"]`" and readers always see the current fee. Works for fees, central bank rates, inflation, take-home pay and income tax.

= Built to sit nicely on your site =

* Five blocks for the block editor (Take-home pay, Mobile money fees, Fee table, Rates, Calculator) with live previews, plus shortcodes for classic editors and page builders.
* A settings screen with a widget builder and live preview: pick a widget, copy the shortcode.
* Your accent colour, light or dark scheme (or follow the visitor's device), and your theme's fonts.
* Fast: the script loads only on pages that use a widget, is deferred, and has no dependencies. Fee tables, rates and live figures are plain HTML, so search engines read them.
* Every widget shows when its rates were last checked, with links to the official sources.
* Translation ready.

= Where the numbers come from =

The rules are researched and maintained by [SwiftPesa](https://swiftpesa.co.ke), which checks them against revenue authorities, central banks and mobile money providers. They're published as open data under Creative Commons Attribution 4.0. You can see every source in the [SwiftPesa Open Data API](https://swiftpesa.co.ke/developers/).

== External services ==

This plugin downloads data from the SwiftPesa Open Data API (https://swiftpesa.co.ke/api/open/v1/). Without it, the plugin has nothing to show.

* **What is downloaded:** calculator rules (tax bands, deductions, fee tables, loan and savings parameters), the list of countries, and central bank indicators.
* **When:** once when you activate the plugin, then twice a day by WordPress cron, and when you click Sync now in the plugin's settings.
* **What is sent:** an ordinary HTTPS request from your server. As with any WordPress request, it includes your server's IP address and WordPress's standard user agent, which contains your site's address. No personal data about you or your visitors is sent, and nothing is sent when visitors use a widget: calculations happen on your site and in their browser.

The service is provided by SwiftPesa: [Terms of use](https://swiftpesa.co.ke/terms-of-use/), [Privacy policy](https://swiftpesa.co.ke/privacy-policy/).

Optionally, you can turn on a small "Data: SwiftPesa" link under widgets in Settings. It's off unless you turn it on.

== Installation ==

1. Install and activate SwiftPesa from Plugins → Add New (search for "SwiftPesa").
2. Open **SwiftPesa** in the admin menu. The data downloads on activation; the screen shows when it last synced.
3. Pick a widget in the builder, copy the shortcode into a post or page, or add one of the SwiftPesa blocks in the block editor.
4. Optional: set your default country, accent colour and colour scheme.

== Frequently Asked Questions ==

= Which countries are covered? =

Take-home pay: Kenya, Nigeria, South Africa, Ghana, Uganda, Tanzania, Zambia, Zimbabwe, Botswana, Namibia, Lesotho and Malawi. Mobile money fees: Kenya, Uganda, Tanzania, Ghana, Zambia, Zimbabwe, Botswana and Lesotho. Central bank rates: all 12 countries. New countries appear automatically when SwiftPesa adds them.

= How quickly do new rates show up? =

Your site syncs twice a day, so within 12 hours of SwiftPesa updating a calculator. Click Sync now in the settings to update immediately. If you use a page cache, cached pages update when the cache refreshes.

= What happens if SwiftPesa is unreachable? =

Your widgets keep using the last copy your site downloaded. The settings screen tells you if a sync failed.

= Does it slow my site down? =

No. Nothing loads on pages without a widget. On pages with one, the script is small, deferred, and makes no network requests: the rules are already in the page.

= Do I need an account or an API key? =

No. The data is free and needs no key.

= Do I have to credit SwiftPesa? =

The data is published under Creative Commons Attribution 4.0, which asks you to credit SwiftPesa somewhere on your site. The simplest way is the optional "Data: SwiftPesa" link in Settings. A mention on your sources or about page works too.

= Is this financial advice? =

No. The calculators give estimates from published rules. Each widget links to its official sources, and readers should check with their employer, bank or provider for their exact figures.

= Can I show only some columns of a fee table? =

Yes: `[swiftpesa_fee_table country="ke" columns="send,withdraw"]`. The builder in Settings lists each country's tables.

== Shortcodes ==

* `[swiftpesa_take_home country="ke"]`: take-home pay. `country="all"` lets visitors pick; `gross="50000"` sets the starting amount.
* `[swiftpesa_mobile_money country="ke" amount="2500"]`: mobile money fees.
* `[swiftpesa_fee_table country="ke"]`: the full tariff table.
* `[swiftpesa_rates countries="ke,ug,tz"]`: central bank rate and inflation.
* `[swiftpesa_calculator slug="kenya-mortgage-loan-calculator"]`: loans, savings, money market funds, SACCO dividends, PesaLink fees.
* `[swiftpesa_value type="fee" country="ke" amount="2500"]`: one live figure. Also `type="rate" indicator="inflation"`, `type="take-home" gross="50000"` and `type="tax" gross="50000"`.

Countries can be codes (ke, ng, za) or names (Kenya, South Africa). Amounts can be written 50000, 50,000 or 50k.

== Screenshots ==

1. The SwiftPesa screen: sync status and the widget builder with a live preview.
2. Take-home pay calculator with country picker.
3. A mobile money fee table that updates itself.
4. Central bank rates and inflation for several countries.
5. A live fee inside a blog post.
6. SwiftPesa blocks in the block editor.
7. Mortgage and loan repayment calculator.

== Changelog ==

= 1.0.0 =
* First release: take-home pay, mobile money, fee table, rates and calculator blocks and shortcodes; live figures; widget builder with preview; twice-daily sync.

== Upgrade Notice ==

= 1.0.0 =
First release.
