German title: “Lastschriften in Überweisungen konvertieren”

We have had the situation that a SEPA direct debit was sent twice to the bank.

Now we need to credit our customers the amount again.

I did not find an open source script that reverses a direct debit, but I found which can write SEPA direct credit files.

Preparation on CentOS7:

yum install epel-release
yum install php-cli composer
composer require AbcAeffchen/Sephpa

Then get the index.php from below, modify the filename of the direct debit file, and the execution and creation date, and pipe the result:

php reverseSEPA.php > directcredit.xml

Here is the script:

Tags: ,
Posted in Software Development | Comments Closed

With the coming switch in Germany from Bank account number and banking sort code (BLZ) to IBAN and BIC, there are quite some tasks to accomplish.

One task is to convert the bank account numbers to the new IBAN number.
On the first look, you might think that it is simply concatenating the account number and BLZ, add a checksum digit, and you are done. Eg: kto=648489890 and blz=50010517 becomes IBAN DE12500105170648489890
But in fact there are currently 54 rules, explained on 171 pages (see Bundesbank IBAN_Regeln).

There is an Open Source library available under LGPL that does implement all these rules:

It can be used from several programming languages, among them C# and PHP (see
I have packaged it for PHP to offer it as a webservice for OpenPetra.
You can test it live here:
I have added an option to use it as a webservice.
Eg. returns an xml file like this:

<ort>Frankfurt am Main</ort>

The packages are built on the Suse Open Build Service:
At the moment I build it for CentOS5, CentOS6, and Debian 7. If you are interested in other distributions that are available on build.opensuse, let me know, I might add that.

Installation instructions for CentOS5, CentOS6 and Debian 7 see: