uabankpay.dart

UABankPay is a Flutter-compatible Dart library for integrating Ukrainian direct (IBAN to IBAN) payments into your applications. It provides a simple and efficient way to generate payment links and parse them back, based on the NBU QR specification version 3.

This is the Dart/Flutter port of uabankpay.js.

Note: Library uses NBU QR version 3 specification, which is the latest version as of the moment of writing this README (August 2026). If you are looking for a library that implements the older version of the specification, please check out other projects or contribute to this one by adding support for the older version.

The library is based on the NBU QR specification, which defines the format and requirements for generating payment links for direct payments in Ukraine.

See full specification at https://zakon.rada.gov.ua/laws/show/v0097500-25

The library is designed to be flexible and easy to use, implementing most common features of the NBU QR specification. It has zero external dependencies — only the Dart SDK (dart:convert) is required — so it works everywhere Dart runs: Flutter (iOS, Android, web, desktop), plain Dart servers, and CLI tools.

Installation

Add uabankpay as a dependency in your pubspec.yaml:

dependencies:
  uabankpay: ^0.1.0

Then run dart pub get or flutter pub get.

Usage

Import the library and use the generatePayLink and parsePayLink functions along with the UaBankPayLinkRequest class:

import 'package:uabankpay/uabankpay.dart';

// Form a payment request object with the necessary details.
// Only receiverName, receiverIban, amount and receiverCode are required;
// the rest default to empty values / changeable behavior.
final paymentRequest = UaBankPayLinkRequest(
  receiverName: 'ГО "Верховний Порядок"',
  receiverIban: 'UA743077700000026001611157323',
  amount: 'UAH123.45',
  receiverCode: 43723254,
  destination: 'Добровільний внесок 12345',
  reference: 'AAABBBCCCDDDEEEFFF1234',
  display: 'Добровільний внесок',
  changeable: false,
);

// Generate the payment link using the NBU QR specification
final paymentLink = generatePayLink(paymentRequest);
print(paymentLink); // This link can be used directly or used in QR code generation

You can also decode an existing payment link back into a payment request object:

import 'package:uabankpay/uabankpay.dart';

final request = parsePayLink('https://bank.gov.ua/qr/QkNECjAwMwox...');
print(request.receiverIban); // UA743077700000026001611157323

API reference

generatePayLink(request: UaBankPayLinkRequest): String

Generates an NBU QR payment link from the given payment request. The generated link is binary-identical to the output of the JavaScript library, so links generated by one can be parsed by the other.

parsePayLink(url: String): UaBankPayLinkRequest

Parses a payment link generated according to the NBU QR specification back into a payment request object. Passing the parsed object back to generatePayLink reproduces the original link.

UaBankPayValidationError

Thrown by both functions when input is invalid. Its field property identifies the offending request field (or 'url' when parsing fails), so consumers can catch and handle errors precisely:

import 'package:uabankpay/uabankpay.dart';

try {
  generatePayLink(UaBankPayLinkRequest(
    receiverName: '',
    receiverIban: 'UA743077700000026001611157323',
    amount: 'UAH123.45',
    receiverCode: 43723254,
  ));
} catch (error) {
  if (error is UaBankPayValidationError) {
    print('Invalid field: ${error.field}'); // e.g. "Invalid field: receiverName"
  }
}

Payment request fields

Field Type Required Constraints
receiverName String yes Non-empty, up to 140 characters
receiverIban String yes Ukrainian IBAN: UA followed by 27 digits
amount String yes UAH prefix optional, positive number, up to two decimal places
receiverCode int|String yes 8-digit EDRPOU or 10-digit RNOKPP; prefer strings to preserve leading zeros
destination String no Up to 420 characters
reference String no Up to 35 characters
display String no Up to 140 characters
changeable bool no Whether the payer may edit fields before confirming (default true)

All limits follow the NBU QR version 3 specification (Постанова НБУ №97). Validation errors carry the failed field name in error.field.

UaBankPayProvider.generatePayLink() remains available as a deprecated alias for generatePayLink() and will be removed in a future major release.

Supported banks

The library was tested with the same set of banks as the JavaScript version, and it produces links that are fully compatible with them. See the JavaScript library README for the full table.

Development

Building / analyzing

dart analyze

Testing

dart test

Contributing

If you want to contribute to the development of UABankPay, feel free to fork the repository and submit a pull request. We welcome any contributions that can help improve the library.

Contact author

If you have any questions, suggestions, or issues regarding UABankPay, please feel free to contact us. You can open an issue in the GitHub repository or reach out via email at contact@sirkadirov.com.

License

UABankPay is licensed under the MIT license. You can find the full license text in the LICENSE file in the repository. This library is provided "as is", without any warranties or conditions of any kind, either express or implied. We are not liable for any damages arising out of or in connection with the use of this library.

Libraries

uabankpay
UABankPay is a library for integrating Ukrainian direct (IBAN to IBAN) payments into your applications. It provides a simple and efficient way to generate payment links and parse them back, based on the NBU QR specification version 3.