How it works & privacy
What happens to
your data?
Mizan does the calculation in your browser. Your token and account balances aren't sent to me.
Your browser does the work.
Mizan reads balances directly from Lunch Money and prices from the metal-price service. It calculates in your browser, without sending your token or account balances to Mizan's author.
It uses read-only requests. Your token and balances are not saved by Mizan. Only your method preferences stay in this browser.
Need help connecting? Start with the token guide
Privacy & connections
Your token
Lunch Money has no "log in with Lunch Money" button for other apps yet, so Mizan uses an access token that you make in Lunch Money.
- You paste the token in the field and click Connect.
- The page copies the token into a variable in memory, and clears the field at once, before the first request.
- The page sends the token only in the
Authorization: Bearerheader of the requests toapi.lunchmoney.dev. The token is never in a web address. - When the requests finish, the page sets the variable to
null. No code uses the token again.
The token field uses a password input with autocomplete disabled and hints asking password managers (1Password, LastPass and Bitwarden) to ignore it. These hints are not a guarantee: a browser or password manager may still offer to save it. The password input masks the characters in browsers, including Firefox.
Lunch Money tokens can change data. Lunch Money has no read-only tokens yet. Mizan never changes data, but the token itself can. Make a separate token for Mizan, and revoke it on the Lunch Money developers page when you finish.
Requests
Every request uses fetch() with method: "GET", credentials: "omit", cache: "no-store", redirect: "error" and referrerPolicy: "no-referrer". Because redirects are an error, the token cannot follow a redirect to another host.
| # | Request | Type | What the page reads |
|---|---|---|---|
| 1 | GET /v2/me | Required | Your budget name and its primary currency. This request goes first, alone. |
| 2 | GET /v2/plaid_accounts | Required | Your synced bank, card, investment and loan accounts. |
| 3 | GET /v2/manual_accounts | Required | Your manual accounts. |
| 4 | GET /v2/crypto/manual | Optional | Your manual crypto. |
| 5 | GET /v2/crypto/synced | Optional | Your synced crypto, 1 row for each coin. |
| 6 | GET /v2/balance_history | Optional | Month-end balances from 12 months ago to last month, for the hawl. |
| 7 | GET api.gold-api.com/price/XAU/<CUR> | Optional | The gold price in your currency. No token. |
| 8 | GET api.gold-api.com/price/XAG/<CUR> | Optional | The silver price in your currency. No token. |
After request 1 succeeds, requests 2 to 8 start at the same time. Requests 1 to 6 use the current v2 API at https://api.lunchmoney.dev/v2. The page asks for balance_history only up to last month, because the current month can be in the future for the server in some time zones. For today, the page uses the amounts on the screen.
Connecting YNAB
YNAB uses its own sign-in (OAuth), so there is no token to copy. Mizan asks YNAB for read-only access, which YNAB enforces: any request that would change your plan is refused.
- You choose Connect with YNAB. The page saves a random one-time code (the
state) in session storage and sends you toapp.ynab.com. - You sign in on YNAB's site and allow access. Mizan never sees your YNAB password.
- YNAB sends you back with a short-lived access token in the address fragment (after
#), which browsers never send to a server. The page checks the one-time code, deletes it, and removes the token from the address bar and browser history at once. - The token is kept only in memory for the requests below, sent only in the
Authorization: Bearerheader toapi.ynab.com, then set tonull. YNAB ends it after 2 hours in any case.
| # | Request | Type | What the page reads |
|---|---|---|---|
| 1 | GET /v1/plans?include_accounts=true | Required | Your plans with their accounts, balances and currency. Mizan uses the plan changed most recently, and says so when you have more than one. |
| 2 | GET /v1/plans/{id}/transactions?since_date=… | Optional | Transactions from the last 13 months, used only to work out month-end balances for the hawl. |
- Amounts: YNAB stores amounts in thousandths (milliunits), so Mizan divides by 1,000. Credit cards and loans are negative in YNAB and are shown as positive debts.
- Account types: checking, savings and cash count. Credit cards are deducted by default; loans and lines of credit are listed but not selected. Mortgages go to the mortgage setting. Tracking accounts count when their name looks like an investment (for example “TFSA” or “Brokerage”); others, such as a house or car, are listed but not selected.
- History: YNAB has no balance history, so each month-end balance is today’s balance less the transactions dated after that month. Months before an account’s first transaction, while it was still empty, are treated as before it opened.
- Not current: an account whose bank import has an error in YNAB is marked “not current”. Tracking accounts get a note, because their balances are usually updated by hand.
To remove Mizan's access early, go to Account Settings in YNAB. See the privacy policy.
What the page saves
The page saves only your choices, in your browser's localStorage, under the key lunchmoney-zakat-choices-v1:
- the nisab metal (silver or gold) and the mortgage method
- the 2 nisab weights
- the gold purity and the silver purity
It never saves amounts or your token. A reload or Start again removes all amounts. Reset my method choices removes the saved choices and sets the defaults again.
How the calculation works
From accounts to rows
The function kindOf() puts each Lunch Money account in 1 group, from its type. The amount is to_base: the balance in your budget's currency, at the Lunch Money exchange rate. This follows the official amounts and balances guide.
| Lunch Money type | Mizan group | Where it goes | Selected at the start |
|---|---|---|---|
| cash, depository, checking, savings | Cash | Review balances, accounts | Yes |
| investment, brokerage, cryptocurrency | Investment | Review balances, accounts | Yes |
| credit | Card | Review balances, debts | Yes, except a deactivated card |
| loan, other liability | Loan | Review balances, debts | No. You type the part that is due now. |
| loan with "mortgage" in its subtype or name | Mortgage | A note under the debt list | No row. You type the payment. |
| other asset, employee compensation | Other | Review balances, accounts | No |
| real estate, vehicle, any other type | Skip | Not used | Not used |
Special cases
- Closed and inactive accounts get the amount 0. Their history stays, so they count in the hawl for the months when they had a balance.
- Deleted accounts from the balance history are used in the same way. A deleted home, car or loan is not used.
- Crypto with no price: when Lunch Money has no price for a coin,
to_baseis empty. The page shows the row at 0, not selected, and asks you to type the value. It never uses the number of coins as money. - Credit cards: a balance below 0 today (a credit) becomes 0. A card that you paid in full stays in the list, for its past month-end balances.
- Retirement accounts (RRSP, RRIF, LIRA, 401(k), IRA, Roth, pension and others) get a note. The page tests the subtype and the account's own name, not the bank name.
- Other currencies: an account in a different currency gets a note that the amount is at the Lunch Money exchange rate.
- Balances that are not current: a row gets the badge "not current" when its balance is more than 3 days old, or when its connection needs a relink or has an error.
Following every amount
Each account is marked Lunch Money when its amount matches the imported balance rounded to cents, or Adjusted here when you edit it. Manual additions and deductions are marked Added here. Sample mode uses fictional balances labelled Sample balance.
On Your estimate, the waterfall graph uses the same amounts as the calculation: selected accounts, added assets, deductions, and the total after debts. Open See every amount in this total to review every included account, asset and deduction. Missing metal prices stay incomplete.
The balance-history graph connects only adjacent months with all selected account and debt balances available. Hollow points are partial subtotals; missing months have no point. Use the slider with a pointer or arrow keys for exact amounts, or open the monthly table. The graph excludes manually added assets, other debts and mortgage deductions, just like the history table.
Gold and silver prices
The page asks api.gold-api.com for the price of 1 troy ounce of gold (XAU) and silver (XAG) in your budget's currency. It divides each price by 31.1034768, the number of grams in 1 troy ounce, to get the price of 1 gram of pure metal.
The page checks that both prices are more than 0 and in your currency. If a request fails, or the service does not have your currency, both price fields stay empty, and a warning asks you to type today's prices. You can always change the prices.
The formulas
The function totals() reads the current input values each time you change something. Imported account amounts are rounded to 2 decimal places in their fields; gold prices to 3 and silver prices to 4. The calculation uses those values and formats the result as currency.
Fields for amounts that cannot be below 0 count as 0 when they are below 0. An account in the account list can be below 0, for example an overdraft. The page calculates the same totals for all 6 methods (silver or gold nisab, with each of the 3 mortgage choices) and shows them side by side.
A method needs its nisab metal's price and weight. If you add gold or silver that you own under Add other assets, its price is also required, even when you choose the other metal for the nisab. Missing prices show Incomplete, rather than a zero zakat amount. The estimate assumes that your hawl is complete; the history table does not decide whether zakat is due.
For a mortgage deduction, enter the deductible amount per payment under your chosen method. For the next 12 months, use the average deductible amount per payment and the number of payments. Mizan does not separate principal and interest for you.
Example: the sample data
| Item | Amount (CAD) |
|---|---|
| Chequing, savings, TFSA, RRSP and a bitcoin wallet | 33,100.00 |
| Less the credit card | 650.00 |
| Total after debts | 32,450.00 |
| Silver nisab: 595 g at about 2.43 a gram | about 1,446 |
| Zakat: 2.5% of 32,450.00 | 811.25 |
The hawl check
The hawl is a lunar year used in deciding when zakat is due. Scholars differ on how changes below the nisab affect it. This table provides month-end history for your review; it cannot confirm a complete hawl.
- The page makes 13 rows: the last 12 months and today.
- For each past month, it adds the month-end balances of the selected accounts in the account list, and it subtracts the selected debts in the debt list.
- For today, it uses the amounts that you see in the account and debt lists.
- A past month with no balance for any selected account shows "No data", for example the months before you started to use Lunch Money. It does not count as below the nisab.
- A month with some selected balances missing shows a Partial label and a total of the balances available. It is not classified as above or below the nisab. Missing balances are unknown, including gaps for closed accounts.
- The page compares complete rows with today's nisab. It shows the lowest complete total, and lists complete rows that were below the nisab. A zero balance counts as data.
The table excludes the additional assets, other debts and the mortgage, including in today's row. Its totals can differ from your zakat estimate.
The page cannot see a drop below the nisab inside a month, because Lunch Money keeps 1 balance for each month. 12 calendar months are close to a lunar year (354 days) but not the same. The Zakat guide explains the hawl rules.
Things to know
Errors and warnings
| Case | What you see |
|---|---|
| The token does not work (401 or 403) | An error. Copy all of the token again, or make a new token. |
| Too many requests (429) | An error. Wait 1 minute, then try again. |
| No connection, or a redirect | An error. Check your internet connection. |
| A required request fails | The page stops and stays on the connect screen. |
| Crypto or balance history fails | A warning. The calculator still works without that data. |
| No price in your currency | A warning. Type today's gold and silver prices. |
Limits
- The rate is always 2.5% of the whole total. The page has no option for a solar year.
- Shares, funds and retirement accounts count at their full value. The page has no option to count only part of an investment, or to delay zakat on retirement money. You can change an amount or clear the box.
- Jewellery has no separate option. If you add gold or silver under Add other assets, it counts at its weight, purity and price.
- The hawl uses month-end balances and today's nisab. It does not use past prices, and it does not include the additional assets, the other debts or the mortgage.
- The page reads only the budget of your token.
- The page does not pay zakat or keep a record of it.
- Mizan gives an estimate. Ask your imam or a zakat scholar to confirm the method that you follow.
For a closer look
Security headers
The page sets this Content Security Policy in a meta tag, and Netlify sends it again as a header:
| Rule | Effect |
|---|---|
default-src 'none' | The page can load nothing that the policy does not name. |
connect-src | The script can connect only to https://api.lunchmoney.dev, https://api.ynab.com and https://api.gold-api.com. |
script-src 'unsafe-inline' | Inline JavaScript is allowed, including inline event handlers. External script files are blocked, including files from this site. This policy does not distinguish Mizan's script from any other injected inline script. |
style-src 'self' 'unsafe-inline' | The shared stylesheet comes from this site. Inline styles are allowed for the balance-history bars. |
font-src 'self' | Fonts come only from the site of the page. |
img-src data: | All images are inside the page. The page loads no image files. |
frame-ancestors 'none' | Other websites cannot show the page in a frame. This rule comes only from the Netlify header. |
Netlify also sends Referrer-Policy: no-referrer, X-Content-Type-Options: nosniff, X-Frame-Options: DENY and a Permissions-Policy that turns off the camera, the microphone, location and payment.