blog·5 min read

A payment batch that stops at a new IBAN

Turning your open purchase invoices into a payment file is the easy part. The real work is answering whether the account number is still the right one. How we built that check.

Turn the open purchase invoices into a payment file I can import into
my bank, and hold back anything that does not add up.

A café pays its suppliers by hand. Someone checks the accounting for open invoices, looks up the account number per supplier and types the payments into online banking. That works, until there is one zero too many, or until a supplier suddenly has a different account number.

We built a payment batch for that. The app reads the open items from the accounting, turns them into a SEPA file, and the owner imports that file into the bank and approves it there. It is built and in testing. The customer stays anonymous and there are no amounts, prices or margins here.

Creating the file turned out to be the smallest part of the job. The biggest part is everything you have to hold back.

What belongs in a batch and what does not

The accounting gives you everything under open creditor items that has not been reconciled yet. That is far more than what you want to pay. In one sample there were close to a hundred open items, and about half of them were not invoices at all but bank statement lines. Of the rest, a sizeable share was already settled or collected by direct debit.

So the app only picks up items that meet three conditions at the same time: the type is a purchase invoice, the payment method is a bank transfer, and the open amount is greater than zero.

That second one matters most. A supplier who collects by direct debit does not belong in a payment file. Pay them by transfer anyway and they will collect a few days later regardless, leaving you down twice. Credit notes go out for the same reason: you settle those, you do not pay them.

The account number is the whole story

The IBAN is not part of the open item. You have to fetch it per supplier from the contacts. That brings three things that can go wrong.

Not every supplier has one. In that same sample, one of the thirteen suppliers with an open transfer had no account number in the accounting at all. That is not a bug in the app, it is a gap in the administration, and you want to see it before you build a file rather than after.

The number can be nonsense. An account number typed in by hand can contain spaces, can be too short, or can simply hold a typo. So we strip everything that is not a letter or a digit, uppercase it, check the length for the country and run the check from ISO 13616: move the first four characters to the end, replace letters with numbers and see whether the remainder when divided by 97 is exactly 1. That catches almost every typo.

The number can have changed. And this is the interesting one.

Why the app remembers the previous account number

While we were looking through the administration, one rent payment turned out to have gone to a different account number than the one on file for the landlord. That can be a mistake. It can also be the best known invoice fraud there is: someone mails on behalf of a supplier that the account number has changed, and in a busy week someone updates it without picking up the phone.

A check on the shape of the number does not help against that. A fraudulent IBAN is a perfectly valid IBAN.

What does help: remembering where you paid last time. The app stores, per supplier, the account number the last batch went to. If the number in the accounting differs from it, that line does not make it into the file. It says in plain words which number it was and which number it is now, and an administrator has to accept the new one first.

That is not a warning you can click away. It is a block: as long as nobody accepts it, the file is built without that line.

A supplier you are paying for the first time has no previous payment, so there is nothing to compare against. That line is flagged as new, so somebody looks at it on purpose.

Blocks and warnings are not the same thing

We keep those two strictly apart.

A block takes the line out of the file. That happens for a missing, invalid or changed account number, for an item that is already in an earlier batch, for an amount that is not greater than zero or has more than two decimals, for a supplier name that has nothing usable left after cleaning it for the SEPA character set, and for an execution date in the past.

A warning leaves the line in but asks for attention. The most important one is an item older than six months. Those have often been paid already and simply were not reconciled, and if you take them along without thinking you pay a second time.

The app does not pay anything

This is the rule everything rests on: the app writes nothing back to the accounting and queues no payment at the bank itself. It produces a file. That file goes into online banking, where a person sees what is about to happen and approves it.

The accounting only reconciles the items once the bank statement comes in. That is slower than an integration that marks them off immediately, and it is far better: the accounting stays the truth about what was actually paid, and there is never a moment where the app has reported something the bank did not do.

Common mistakes

Reading every open item as payable. Statement lines, direct debits and credit notes sit in there just as much.

Including direct debit suppliers. They get paid twice, and you only notice on the bank statement.

Checking only the shape of the IBAN. A fraudulent account number passes every check digit test. Comparing against the previous payment is the check that works.

Showing a changed account number as a warning. A warning gets clicked away. This has to be a block.

Reading an unknown outcome as approval. If fetching the account number fails, that is not a reason to continue, it is a reason to skip that line.

What an integration on this accounting package can do is on connecting Nmbrs. How we determine the status of every incoming invoice is in in, booked or still waiting, and the quirks of the API are in the Nmbrs Accounting API. If you want something like this for your own administration, see custom software.

MK
Maarten Keizer

Founder of Invoker. Over twenty years in hosting, system administration and web development; builds the Claude hosting himself and tests everything on our own servers first.

about maarten