stdnum.ch.esr

ESR, ISR, QR-reference (reference number on Swiss payment slips).

The ESR (Eizahlungsschein mit Referenznummer), ISR (In-payment Slip with Reference Number) or QR-reference refers to the orange payment slip in Switzerland with which money can be transferred to an account. The slip contains a machine-readable part that contains a participant number and reference number. The participant number ensures the crediting to the corresponding account. The reference number enables the creditor to identify the invoice recipient. In this way, the payment process can be handled entirely electronically.

The number consists of 26 numerical characters followed by a Modulo 10 recursive check digit. It is printed in blocks of 5 characters (beginning with 2 characters, then 5x5-character groups). Leading zeros digits can be omitted.

More information:

>>> validate('21 00000 00003 13947 14300 09017')
'210000000003139471430009017'
>>> validate('210000000003139471430009016')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> format('18 78583')
'00 00000 00000 00000 00018 78583'
stdnum.ch.esr.calc_check_digit(number)

Calculate the check digit for number. The number passed should not have the check digit included.

stdnum.ch.esr.compact(number)

Convert the number to the minimal representation. This strips surrounding whitespace and separators.

stdnum.ch.esr.format(number)

Reformat the number to the standard presentation format.

stdnum.ch.esr.is_valid(number)

Check if the number is a valid ESR.

stdnum.ch.esr.validate(number)

Check if the number is a valid ESR. This checks the length, formatting and check digit.