Skip to content

From your bank

Badlen can read a current account’s booked operations and balance at its bank, four times a day, through an application of your own at Enable Banking, a reading service that holds the registration banks require. Setting it up takes four steps, below: create the application, turn the reading on in the instance, give Badlen the application’s key, then link each account. The first two are done by the person running the instance; the key and the accounts are each reader’s own, and no account of anyone else’s goes through them. Enable Banking keeps the list of banks it reaches, and How Badlen reads a bank explains why it works this way.

It reads current accounts: their booked operations and their booked balance. Pending operations are left out, because their wording changes once they book. A card whose purchases are debited from its current account is not read as an account of its own: its spending already arrives as operations of that current account.

Banks do not offer savings books, PEAs, life insurance contracts or brokerage accounts through this channel. Those stay on the balances you state each month, by hand or from a statement.

1. Create the application at Enable Banking

Section titled “1. Create the application at Enable Banking”
  1. Sign up on the Enable Banking control panel and create an application.
  2. Choose restricted production. It reads the accounts you link to it yourself, which is all Badlen needs; there is no need to ask for the restriction to be lifted.
  3. Under Redirect URLs, enter https://badlen.fr/bank-return/. That return page works for any instance. An instance with a public https address of its own can list that address’s return page instead, and set BANK_SYNC_RELAY_URL to the same value.
  4. Leave the allowed widget origins and the webhook fields empty: Badlen uses neither.
  5. Download the application’s private key, a .pem file, and keep it somewhere safe: it is offered once. Note the application id beside it; the two go together.
  6. In the control panel, link to the application the bank accounts you want read.

The person running the instance does this once:

  1. Set BANK_SYNC_ENABLED=true in .env, beside the other settings of Configuration, and restart.
  2. In Settings → Administration, the Bank connection switch is on by default. Turning it off closes the reading for every reader without editing .env.

In Settings → Syncs (/reglages/synchronisations), the Bank reading key card asks for the Application identifier and the private key: choose the .pem file. Before saving, the card shows the file’s name and says whether it holds a private key. Once saved, it shows the application id and stored encrypted, and never a character of the key again; Replace opens the form anew.

On the same tab, press Connect a current account, pick the account if you have several, then your bank’s country and name. Your bank’s own page opens. Once you approve, it sends you back to Badlen, which says The account is linked to your bank, and its history is imported.

When the bank opens several accounts at once, Badlen links the one it already knows by its bank identifier, or the only current one. Otherwise it asks which one this is, within the hour the bank allows.

What Badlen says What it means
Reading bank accounts is turned off on this instance. BANK_SYNC_ENABLED is not true, or the Bank connection switch is off: see step 2
No bank reading key is stored. the key was never saved, or was removed: see step 3
The key card says unreadable the key was encrypted with another SECRET_ENCRYPTION_KEY than the instance’s: choose the .pem again
The bank reading application does not accept the return address… the address the message names is missing from the application’s Redirect URLs (REDIRECT_URI_NOT_ALLOWED)
The bank reading service refuses the stored key… the application id and the private key do not belong together, or the application no longer exists
The bank reading service does not know this bank in this country. check the country picked before the bank; a bank missing from the service’s list cannot be read
The bank did not grant access. Nothing has changed. the approval stopped on the bank’s page
Connecting to the bank failed. Nothing has changed; try again. the way back from the bank broke off; start again
The account is linked to your bank, but reading its operations failed… Sync within the hour reads the whole history; after that the bank serves 90 days only, and only renewing the access brings back the rest
The bank opened no current account. Nothing is linked. the bank offered only cards, or only accounts already linked
The account can no longer be chosen: the hour the bank allows has passed… the bank opened several accounts and none was picked within the hour: reconnect the account
The bank refuses further reads for now… the bank’s allowance for the day is used up; the next scheduled read tries again
The bank reading service did not answer properly. the service failed this time; the next scheduled read tries again
The authorisation given to the bank has expired or was withdrawn… the access ended, the bank withdrew it early, or Badlen closed it when the key changed: reconnect the account

On the Syncs tab, an account whose last read failed shows Read failing with the reason. When the reason is the key, the key card is on that same tab. An account whose first read did not finish within the hour says History incomplete: renewing the access catches up the rest.

  • The first read takes the whole history the bank serves in the hour after you approve; after that hour, the bank serves 90 days back at most. On an account whose operations already came in from statements, it starts the day after the last one, so a line the bank words differently is not written twice.
  • Afterwards Badlen reads each linked account four times a day, at 01:00, 07:00, 13:00 and 19:00 by the server’s clock, which is what the bank allows without you present. Sync reads at once. Each read starts a week before the previous one, because a bank lists some operations days after their booking date; the statement import’s duplicate check keeps them single.
  • The access lasts as long as the bank grants it, 180 days at most. Two weeks before its end, a notice above every page offers to renew it. Renewing goes straight back to the same bank, and the accounts it reads keep their history. A bank that withdraws the access early is shown the same way, as an account to reconnect.

The bank’s booked balance becomes the account’s balance for the day only when it equals Badlen’s: the last balance plus every operation since, to the cent. Otherwise nothing is written and the bank’s figure is shown beside Badlen’s, with the gap. A gap younger than a day is usually the bank counting an operation it has not listed yet; one that outlasts a day of reads may be an operation missing from Badlen, or in it twice.

Settings → Syncs (/reglages/synchronisations) lists every source that keeps an account up to date by itself, and the keys Badlen reads them with. Each bank connection shows its bank, when the access ends and the days left, then each account it reads: its value, its state (up to date, waiting for the bank, balance gap, to renew, to reconnect, read failing with the reason, or account to choose), its last read, its next one, how many operations the last read imported, and how many of the day’s four scheduled reads are left.

From there you read an account now, renew the access early or reconnect it once it has ended, disconnect an account, open it, or connect another one. The row actions are icons, named for a screen reader and on hover; reconnecting an ended access is written out, being the one thing left to do on that card. Disconnecting stops the reads and keeps every operation already imported; once no account reads through it any more, the bank is told to close the access. Removing or replacing the key by another, deleting your account, or restoring a sealed backup that carries another key closes every access the old key opened, and the accounts it read are left to reconnect; a sealed backup that links an account through another access closes the one it replaces. A backup without a passphrase brings no bank link back, and leaves one in place.

The same tab lists the crypto addresses Badlen follows. An account’s own Settings tab keeps one line saying whether a bank reads it, with a link to this tab.

Enable Banking carries out each read for you, so it sees what a read returns: the accounts you linked, their operations and their balances. When you are at the keyboard, on Sync and on the way back from your bank, Badlen also passes on your browser’s address and user agent, as the bank asks; the scheduled reads carry neither.

The way to your bank and back carries a signed note naming the instance’s address, your user identifier in Badlen and the account being linked, encoded but readable. The bank, Enable Banking and the host of badlen.fr can read it, along with the one-time code the bank sends back. None of it is usable without your private key, which never leaves your instance. An instance served over plain http passes that code and that note unencrypted on its own network.

A bank sends you back only to an https address registered in the application, and a self-hosted instance often has none, or one that differs from one reader to the next. So the bank returns to https://badlen.fr/bank-return/, a static page that reads which instance started the connection and forwards the answer there. It keeps nothing. The first time a browser comes back to a given instance address, the page names that address and waits for you to confirm it; after that, it forwards on its own. Your instance then refuses an answer it did not sign, one more than an hour old, or one started in another browser.

An operator who prefers a page of their own sets BANK_SYNC_RELAY_URL to its address, and registers that address in the application instead.