Skip to content
Martijn Bodeman edited this page Dec 31, 2022 · 9 revisions

The IbanBuilder can be used to infer an IBAN from bank, branch and account number information. The IBAN that is generated will have a valid check digit to pass validation.

The information needed to generate a valid IBAN depends per country. Some countries may require that you have the bank, branch and account number information, where others may only require the bank and account number information.

  1. To infer an IBAN, start by getting the country specific information from the IIbanRegistry.
  2. Then, using the builder, supply all the information and invoke .Build().

Example

IIbanRegistry registry = IbanRegistry.Default; // Or use IIbanRegistry from a DI container.
if (registry.TryGetValue("GB", out IbanCountry country))
{
    string iban = new IbanBuilder()
        .WithCountry(country)
        .WithBankIdentifier("NWBK")
        .WithBranchIdentifier("601613")
        .WithBankAccountNumber("31926819")
        .Build();

    Console.WriteLine(iban); // GB29NWBK60161331926819
}